Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Helmo
ISPConfig 3
Commits
7334d4dc
Commit
7334d4dc
authored
11 years ago
by
tbrehm
Browse files
Options
Downloads
Patches
Plain Diff
Merged revision 4125 from stable branch.
parent
8d83c540
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
install/install.php
+2
-0
2 additions, 0 deletions
install/install.php
install/lib/update.lib.php
+39
-5
39 additions, 5 deletions
install/lib/update.lib.php
install/patches/upd_0001.php
+21
-0
21 additions, 0 deletions
install/patches/upd_0001.php
install/update.php
+2
-0
2 additions, 0 deletions
install/update.php
with
64 additions
and
5 deletions
install/install.php
+
2
−
0
View file @
7334d4dc
...
@@ -34,6 +34,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
...
@@ -34,6 +34,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
error_reporting
(
E_ALL
|
E_STRICT
);
error_reporting
(
E_ALL
|
E_STRICT
);
define
(
'INSTALLER_RUN'
,
true
);
//** The banner on the command line
//** The banner on the command line
echo
"
\n\n
"
.
str_repeat
(
'-'
,
80
)
.
"
\n
"
;
echo
"
\n\n
"
.
str_repeat
(
'-'
,
80
)
.
"
\n
"
;
echo
" _____ ___________ _____ __ _ ____
echo
" _____ ___________ _____ __ _ ____
...
...
This diff is collapsed.
Click to expand it.
install/lib/update.lib.php
+
39
−
5
View file @
7334d4dc
...
@@ -27,6 +27,15 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
...
@@ -27,6 +27,15 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
*/
//* Installer patch stub class
class
installer_patch_update
{
protected
function
onBeforeSQL
()
{
}
protected
function
onAfterSQL
()
{
}
}
//* DB dump function
function
prepareDBDump
()
{
function
prepareDBDump
()
{
global
$conf
;
global
$conf
;
...
@@ -151,16 +160,39 @@ function updateDbAndIni() {
...
@@ -151,16 +160,39 @@ function updateDbAndIni() {
$found
=
true
;
$found
=
true
;
while
(
$found
==
true
)
{
while
(
$found
==
true
)
{
$next_db_version
=
intval
(
$current_db_version
+
1
);
$next_db_version
=
intval
(
$current_db_version
+
1
);
$patch_filename
=
realpath
(
dirname
(
__FILE__
)
.
'/../'
)
.
'/sql/incremental/upd_'
.
str_pad
(
$next_db_version
,
4
,
'0'
,
STR_PAD_LEFT
)
.
'.sql'
;
$sql_patch_filename
=
realpath
(
dirname
(
__FILE__
)
.
'/../'
)
.
'/sql/incremental/upd_'
.
str_pad
(
$next_db_version
,
4
,
'0'
,
STR_PAD_LEFT
)
.
'.sql'
;
if
(
is_file
(
$patch_filename
))
{
$php_patch_filename
=
realpath
(
dirname
(
__FILE__
)
.
'/../'
)
.
'/patches/upd_'
.
str_pad
(
$next_db_version
,
4
,
'0'
,
STR_PAD_LEFT
)
.
'.php'
;
if
(
is_file
(
$sql_patch_filename
))
{
//* Load php patch file and instantiate object
if
(
is_file
(
$php_patch_filename
))
{
$php_patch_class_name
=
'upd_'
.
str_pad
(
$next_db_version
,
4
,
'0'
,
STR_PAD_LEFT
);
include_once
(
$php_patch_filename
);
$php_patch
=
new
$php_patch_class_name
;
}
//* Exec onBeforeSQL function
if
(
isset
(
$php_patch
)
&&
is_object
(
$php_patch
))
{
$php_patch
->
onBeforeSQL
();
swriteln
(
$inst
->
lng
(
'Executing PHP patch file'
)
.
': '
.
$php_patch_filename
);
}
//* Load patch file into database
//* Load patch file into database
if
(
!
empty
(
$conf
[
"mysql"
][
"admin_password"
])
)
{
if
(
!
empty
(
$conf
[
"mysql"
][
"admin_password"
])
)
{
system
(
"mysql --default-character-set="
.
escapeshellarg
(
$conf
[
'mysql'
][
'charset'
])
.
" --force -h "
.
escapeshellarg
(
$conf
[
'mysql'
][
'host'
])
.
" -u "
.
escapeshellarg
(
$conf
[
'mysql'
][
'admin_user'
])
.
" -p"
.
escapeshellarg
(
$conf
[
'mysql'
][
'admin_password'
])
.
" "
.
escapeshellarg
(
$conf
[
'mysql'
][
'database'
])
.
" < "
.
$patch_filename
);
system
(
"mysql --default-character-set="
.
escapeshellarg
(
$conf
[
'mysql'
][
'charset'
])
.
" --force -h "
.
escapeshellarg
(
$conf
[
'mysql'
][
'host'
])
.
" -u "
.
escapeshellarg
(
$conf
[
'mysql'
][
'admin_user'
])
.
" -p"
.
escapeshellarg
(
$conf
[
'mysql'
][
'admin_password'
])
.
" "
.
escapeshellarg
(
$conf
[
'mysql'
][
'database'
])
.
" < "
.
$
sql_
patch_filename
);
}
else
{
}
else
{
system
(
"mysql --default-character-set="
.
escapeshellarg
(
$conf
[
'mysql'
][
'charset'
])
.
" --force -h "
.
escapeshellarg
(
$conf
[
'mysql'
][
'host'
])
.
" -u "
.
escapeshellarg
(
$conf
[
'mysql'
][
'admin_user'
])
.
" "
.
escapeshellarg
(
$conf
[
'mysql'
][
'database'
])
.
" < "
.
$patch_filename
);
system
(
"mysql --default-character-set="
.
escapeshellarg
(
$conf
[
'mysql'
][
'charset'
])
.
" --force -h "
.
escapeshellarg
(
$conf
[
'mysql'
][
'host'
])
.
" -u "
.
escapeshellarg
(
$conf
[
'mysql'
][
'admin_user'
])
.
" "
.
escapeshellarg
(
$conf
[
'mysql'
][
'database'
])
.
" < "
.
$sql_patch_filename
);
}
swriteln
(
$inst
->
lng
(
'Loading SQL patch file'
)
.
': '
.
$sql_patch_filename
);
//* Exec onAfterSQL function
if
(
isset
(
$php_patch
)
&&
is_object
(
$php_patch
))
{
$php_patch
->
onAfterSQL
();
}
}
swriteln
(
$inst
->
lng
(
'Loading SQL patch file'
)
.
': '
.
$patch_filename
);
$current_db_version
=
$next_db_version
;
$current_db_version
=
$next_db_version
;
if
(
isset
(
$php_patch
))
unset
(
$php_patch
);
}
else
{
}
else
{
$found
=
false
;
$found
=
false
;
}
}
...
@@ -332,4 +364,6 @@ function updateDbAndIni() {
...
@@ -332,4 +364,6 @@ function updateDbAndIni() {
unset
(
$new_ini
);
unset
(
$new_ini
);
}
}
?>
?>
This diff is collapsed.
Click to expand it.
install/patches/upd_0001.php
0 → 100644
+
21
−
0
View file @
7334d4dc
<?php
if
(
!
defined
(
'INSTALLER_RUN'
))
die
(
'Patch update file access violation.'
);
/*
Example installer patch update class. the classname must match
the php and the sql patch update filename. The php patches are
only executed when a corresponding sql patch exists.
*/
class
upd_0001
extends
installer_patch_update
{
public
function
onBeforeSQL
()
{
// Do something
}
public
function
onAfterSQL
()
{
// Do something
}
}
?>
This diff is collapsed.
Click to expand it.
install/update.php
+
2
−
0
View file @
7334d4dc
...
@@ -34,6 +34,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
...
@@ -34,6 +34,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
error_reporting
(
E_ALL
|
E_STRICT
);
error_reporting
(
E_ALL
|
E_STRICT
);
define
(
'INSTALLER_RUN'
,
true
);
//** The banner on the command line
//** The banner on the command line
echo
"
\n\n
"
.
str_repeat
(
'-'
,
80
)
.
"
\n
"
;
echo
"
\n\n
"
.
str_repeat
(
'-'
,
80
)
.
"
\n
"
;
echo
" _____ ___________ _____ __ _ ____
echo
" _____ ___________ _____ __ _ ____
...
...
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