From 7d52e00a51450bc4a080d4e21b7dda02c0a65191 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Nov 2013 05:42:06 -0500
Subject: [PATCH] Fixed list sorting
---
install/lib/update.lib.php | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php
index 9feffa3..b4e73ab 100644
--- a/install/lib/update.lib.php
+++ b/install/lib/update.lib.php
@@ -27,6 +27,15 @@
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() {
global $conf;
@@ -151,16 +160,43 @@
$found = true;
while($found == true) {
$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';
- if(is_file($patch_filename)) {
+ $sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
+ $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);
+ if(class_exists($php_patch_class_name)) {
+ $php_patch = new $php_patch_class_name;
+ } else {
+ swriteln($inst->lng('WARNING: PHP patch file').': '.$php_patch_filename.' '.$inst->lng('contains errors.'));
+ }
+ }
+
+ //* 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
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 {
- 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').': '.$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();
+ }
+
$current_db_version = $next_db_version;
+ if(isset($php_patch)) unset($php_patch);
} else {
$found = false;
}
@@ -247,6 +283,7 @@
$tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs'];
$tpl_ini_array['fastcgi']['fastcgi_phpini_path'] = $conf['fastcgi']['fastcgi_phpini_path'];
$tpl_ini_array['fastcgi']['fastcgi_starter_path'] = $conf['fastcgi']['fastcgi_starter_path'];
+ $tpl_ini_array['fastcgi']['fastcgi_bin'] = $conf['fastcgi']['fastcgi_bin'];
$tpl_ini_array['server']['hostname'] = $conf['hostname'];
$tpl_ini_array['server']['ip_address'] = @gethostbyname($conf['hostname']);
$tpl_ini_array['web']['website_basedir'] = $conf['web']['website_basedir'];
@@ -331,4 +368,6 @@
unset($new_ini);
}
+
+
?>
--
Gitblit v1.9.1