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
e4058c4c
Commit
e4058c4c
authored
12 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
Add package script and scripts/ folder for scripts
parent
51e2cef4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
setup/scripts/cleanup-codebase.sh
+0
-0
0 additions, 0 deletions
setup/scripts/cleanup-codebase.sh
setup/scripts/package.php
+131
-0
131 additions, 0 deletions
setup/scripts/package.php
with
134 additions
and
0 deletions
.gitignore
+
3
−
0
View file @
e4058c4c
...
...
@@ -5,3 +5,6 @@ include/ost-config.php
.DS_Store
.vagrant
Vagrantfile
# Staging directory used for packaging script
stage
This diff is collapsed.
Click to expand it.
setup/cleanup-codebase.sh
→
setup/
scripts/
cleanup-codebase.sh
+
0
−
0
View file @
e4058c4c
File moved
This diff is collapsed.
Click to expand it.
setup/scripts/package.php
0 → 100755
+
131
−
0
View file @
e4058c4c
#!/usr/bin/env php
<?php
if
(
php_sapi_name
()
!=
'cli'
)
die
(
"Only command-line packaging is supported"
);
$stage_folder
=
"stage"
;
$stage_path
=
dirname
(
__file__
)
.
'/'
.
$stage_folder
;
function
get_osticket_root_path
()
{
# Hop up to the root folder
$start
=
dirname
(
__file__
);
for
(;;)
{
if
(
file_exists
(
$start
.
'/main.inc.php'
))
break
;
$start
.
=
'/..'
;
}
return
realpath
(
$start
);
}
# Check PHP syntax across all php files
function
glob_recursive
(
$pattern
,
$flags
=
0
)
{
$files
=
glob
(
$pattern
,
$flags
);
foreach
(
glob
(
dirname
(
$pattern
)
.
'/*'
,
GLOB_ONLYDIR
|
GLOB_NOSORT
)
as
$dir
)
{
$files
=
array_merge
(
$files
,
glob_recursive
(
$dir
.
'/'
.
basename
(
$pattern
),
$flags
));
}
return
$files
;
}
$root
=
get_osticket_root_path
();
function
exclude
(
$pattern
,
$match
)
{
if
(
is_array
(
$pattern
))
{
foreach
(
$pattern
as
$p
)
if
(
fnmatch
(
$p
,
$match
))
return
true
;
}
else
return
fnmatch
(
$pattern
,
$match
);
return
false
;
}
function
package
(
$pattern
,
$destination
,
$recurse
=
false
,
$exclude
=
false
)
{
global
$root
,
$stage_path
;
$search
=
$root
.
'/'
.
$pattern
;
echo
"Packaging "
.
$search
.
"
\n
"
;
foreach
(
glob
(
$search
,
GLOB_BRACE
|
GLOB_NOSORT
)
as
$file
)
{
if
(
is_file
(
$file
))
{
if
(
$exclude
&&
exclude
(
$exclude
,
$file
))
continue
;
if
(
!
is_dir
(
"
$stage_path
/
$destination
"
))
mkdir
(
"
$stage_path
/
$destination
"
,
0777
,
true
);
copy
(
$file
,
$stage_path
.
'/'
.
$destination
.
'/'
.
basename
(
$file
));
}
}
if
(
$recurse
)
{
foreach
(
glob
(
dirname
(
$search
)
.
'/*'
,
GLOB_ONLYDIR
|
GLOB_NOSORT
)
as
$dir
)
{
if
(
$exclude
&&
exclude
(
$exclude
,
$dir
))
continue
;
package
(
dirname
(
$pattern
)
.
'/'
.
basename
(
$dir
)
.
'/'
.
basename
(
$pattern
),
$destination
.
'/'
.
basename
(
$dir
),
$recurse
-
1
,
$exclude
);
}
}
}
# Create the stage folder for the install files
if
(
!
is_dir
(
$stage_path
))
mkdir
(
$stage_path
);
else
{
$dirs
=
array
();
foreach
(
glob_recursive
(
$stage_path
.
'/*'
)
as
$file
)
if
(
is_dir
(
$file
))
$dirs
[]
=
$file
;
else
unlink
(
$file
);
sort
(
$dirs
);
foreach
(
array_reverse
(
$dirs
)
as
$dir
)
rmdir
(
$dir
);
}
# Source code goes into 'upload'
mkdir
(
$stage_path
.
'/upload'
);
# Load the root directory files
package
(
"*.php"
,
'upload/'
);
# Load the client interface
foreach
(
array
(
'assets'
,
'css'
,
'images'
,
'js'
)
as
$dir
)
package
(
"
$dir
/*"
,
"upload/
$dir
"
,
-
1
,
"*less"
);
# Load the knowledgebase
package
(
"kb/*.php"
,
"upload/kb"
);
# Load the staff interface
package
(
"scp/*.php"
,
"upload/scp/"
,
-
1
);
foreach
(
array
(
'css'
,
'images'
,
'js'
)
as
$dir
)
package
(
"
$dir
/*"
,
"upload/scp/
$dir
"
,
-
1
);
# Load in the scripts
mkdir
(
"
$stage_path
/scripts/"
);
package
(
"setup/scripts/*"
,
"scripts/"
,
-
1
,
"*stage"
);
# Load the heart of the system
package
(
"include/*.php"
,
"upload/include"
,
-
1
);
# And the sql patches
package
(
"include/upgrader/*.sql"
,
"upload/include/upgrader"
,
-
1
);
# Include the installer
package
(
"setup/*.
{
php,txt
}
"
,
"upload/setup"
,
-
1
,
array
(
"*scripts"
,
"*test"
,
"*stage"
));
foreach
(
array
(
'css'
,
'images'
,
'js'
)
as
$dir
)
package
(
"setup/
$dir
/*"
,
"upload/setup/
$dir
"
,
-
1
);
package
(
"setup/inc/sql/*.
{
sql,md5
}
"
,
"upload/setup/inc/sql"
,
-
1
);
# Load the license and documentation
package
(
"*.
{
txt,md
}
"
,
""
);
# Make an archive of the stage folder
$version_info
=
preg_grep
(
'/THIS_VERSION/'
,
explode
(
"
\n
"
,
file_get_contents
(
"
$root
/main.inc.php"
)));
foreach
(
$version_info
as
$line
)
eval
(
$line
);
$pwd
=
getcwd
();
chdir
(
$stage_path
);
shell_exec
(
"tar cjf '
$pwd
/osticket-"
.
THIS_VERSION
.
".tar.bz2' *"
);
shell_exec
(
"zip -r '
$pwd
/osticket-"
.
THIS_VERSION
.
".zip' *"
);
chdir
(
$pwd
);
?>
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