Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
ad2d0311
Commit
ad2d0311
authored
11 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
deploy: Touch version number on deployment
parent
574ec1aa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
setup/cli/modules/deploy.php
+30
-4
30 additions, 4 deletions
setup/cli/modules/deploy.php
setup/cli/modules/unpack.php
+1
-1
1 addition, 1 deletion
setup/cli/modules/unpack.php
with
31 additions
and
5 deletions
setup/cli/modules/deploy.php
+
30
−
4
View file @
ad2d0311
...
...
@@ -102,7 +102,7 @@ class Deployment extends Unpacker {
# main.inc.php
$include
=
(
$upgrade
)
?
$this
->
get_include_dir
()
:
(
$options
[
'include'
]
?
$options
[
'include'
]
:
"
{
$this
->
destination
}
/include"
);
:
rtrim
(
$this
->
destination
,
'/'
)
.
"
/include"
);
$include
=
rtrim
(
$include
,
'/'
)
.
'/'
;
# Locate the upload folder
...
...
@@ -119,9 +119,11 @@ class Deployment extends Unpacker {
# Unpack the include folder
$this
->
unpackage
(
"
$root
/include/
{
,.
}
*"
,
$include
,
-
1
,
array
(
"*/include/ost-config.php"
));
if
(
!
$options
[
'dry-run'
]
&&
$include
!=
"
{
$this
->
destination
}
/include"
)
$this
->
change_include_dir
(
$include
);
if
(
!
$options
[
'dry-run'
])
{
if
(
$include
!=
"
{
$this
->
destination
}
/include/"
)
$this
->
change_include_dir
(
$include
);
$this
->
touch_version
();
}
if
(
$options
[
'clean'
])
{
// Clean everything but include folder first
...
...
@@ -132,6 +134,30 @@ class Deployment extends Unpacker {
"*/.htaccess"
));
}
}
function
touch_version
(
$version
=
false
)
{
if
(
!
$version
)
$version
=
exec
(
'git describe'
);
if
(
!
$version
)
return
false
;
$bootstrap_php
=
$this
->
destination
.
'/bootstrap.php'
;
$lines
=
explode
(
"
\n
"
,
file_get_contents
(
$bootstrap_php
));
# Find the line that defines INCLUDE_DIR
$match
=
array
();
foreach
(
$lines
as
&
$line
)
{
// TODO: Change THIS_VERSION inline to be current `git describe`
if
(
preg_match
(
"/(\s*)define\s*\(\s*'THIS_VERSION'/"
,
$line
,
$match
))
{
# Replace the definition with the new locatin
$line
=
$match
[
1
]
.
"define('THIS_VERSION', '"
.
$version
.
"'); // Set by installer"
;
break
;
}
}
if
(
!
file_put_contents
(
$bootstrap_php
,
implode
(
"
\n
"
,
$lines
)))
die
(
"Unable to write version information to bootstrap.php
\n
"
);
}
}
Module
::
register
(
'deploy'
,
'Deployment'
);
...
...
This diff is collapsed.
Click to expand it.
setup/cli/modules/unpack.php
+
1
−
1
View file @
ad2d0311
...
...
@@ -72,7 +72,7 @@ class Unpacker extends Module {
}
}
if
(
!
file_put_contents
(
$bootstrap_php
,
implode
(
"
\n
"
,
$lines
)))
die
(
"Unable to configure location of INCLUDE_DIR in
main.inc
.php
\n
"
);
die
(
"Unable to configure location of INCLUDE_DIR in
bootstrap
.php
\n
"
);
}
function
exclude
(
$pattern
,
$match
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment