From e756e7e8a99d604ef85a9630c856bc0ffae2a3f0 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 10 Jan 2012 05:16:15 -0500
Subject: [PATCH] Fixed: FS#1967 - AWStats statistics not accessible when the website uses suphp.
---
install/update.php | 49 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/install/update.php b/install/update.php
index 091c262..8786658 100644
--- a/install/update.php
+++ b/install/update.php
@@ -78,9 +78,6 @@
if($dist['id'] == '') die('Linux distribution or version not recognized.');
-//** Check version
-if(compare_ispconfig_version('3.0.3',ISPC_APP_VERSION) < 0) die("This updater is for ISPConfig versions > 3.0.3.0. Please Update to ISPConfig 3.0.3.3 first before you update to the current ISPConfig version.\n");
-
//** Include the distribution-specific installer class library and configuration
if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
include_once('dist/lib/'.$dist['id'].'.lib.php');
@@ -99,6 +96,8 @@
$conf["mysql"]["ispconfig_password"] = $conf_old["db_password"];
$conf['language'] = $conf_old['language'];
if($conf['language'] == '{language}') $conf['language'] = 'en';
+$conf['timezone'] = $conf_old['timezone'];
+if($conf['timezone'] == '{timezone}' or trim($conf['timezone']) == '') $conf['timezone'] = 'UTC';
if(isset($conf_old["dbmaster_host"])) $conf["mysql"]["master_host"] = $conf_old["dbmaster_host"];
if(isset($conf_old["dbmaster_database"])) $conf["mysql"]["master_database"] = $conf_old["dbmaster_database"];
@@ -122,7 +121,32 @@
//** Detect the installed applications
$inst->find_installed_apps();
-echo "This application will update ISPConfig 3 on your server.\n";
+echo "This application will update ISPConfig 3 on your server.\n\n";
+
+//* Make a backup before we start the update
+$do_backup = $inst->simple_query('Shall the script create a ISPConfig backup in /var/backup/ now?', array('yes','no'),'yes');
+if($do_backup == 'yes') {
+
+ //* Create the backup directory
+ $backup_path = '/var/backup/ispconfig_'.date('Y-m-d_H-i');
+ $conf['backup_path'] = $backup_path;
+ exec("mkdir -p $backup_path");
+ exec("chown root:root $backup_path");
+ exec("chmod 700 $backup_path");
+
+ //* Do the backup
+ swriteln('Creating backup of "/usr/local/ispconfig" directory...');
+ exec("tar pcfz $backup_path/ispconfig_software.tar.gz /usr/local/ispconfig 2> /dev/null",$out,$returnvar);
+ if($returnvar != 0) die("Backup failed. We stop here...\n");
+
+ swriteln('Creating backup of "/etc" directory...');
+ exec("tar pcfz $backup_path/etc.tar.gz /etc 2> /dev/null",$out,$returnvar);
+ if($returnvar != 0) die("Backup failed. We stop here...\n");
+
+ exec("chown root:root $backup_path/*.tar.gz");
+ exec("chmod 700 $backup_path/*.tar.gz");
+}
+
//** Initialize the MySQL server connection
include_once('lib/mysql.lib.php');
@@ -142,11 +166,17 @@
$clientdb_user = '';
$clientdb_password = '';
-//** Ask user for mysql admin_password if empty
-if( empty($conf["mysql"]["admin_password"]) ) {
-
- $conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']);
-}
+//** Test mysql root connection
+$finished = false;
+do {
+ if(@mysql_connect($conf["mysql"]["host"],$conf["mysql"]["admin_user"],$conf["mysql"]["admin_password"])) {
+ $finished = true;
+ } else {
+ swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
+ $conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']);
+ }
+} while ($finished == false);
+unset($finished);
/*
* Prepare the dump of the database
@@ -155,7 +185,6 @@
//* initialize the database
$inst->db = new db();
-$inst->db->dbName = $conf["mysql"]["database"];
//* initialize the master DB, if we have a multiserver setup
if($conf['mysql']['master_slave_setup'] == 'y') {
--
Gitblit v1.9.1