tbrehm
2012-01-04 1c6b268465d01655553553d01c03d4944138a4b0
Added: FS#1954 - Add a config file backup option in the ispconfig updater
- FS#1898 Added username after client name in IP address list
3 files modified
31 ■■■■■ changed files
install/lib/update.lib.php 6 ●●●● patch | view | raw | blame | history
install/update.php 21 ●●●●● patch | view | raw | blame | history
interface/web/admin/form/server_ip.tform.php 4 ●●●● patch | view | raw | blame | history
install/lib/update.lib.php
@@ -56,7 +56,11 @@
    //if(filesize('existing_db.sql') < 30000) die('Possible problem with dumping the database. We will stop here. Please check the file existing_db.sql');
    // create a backup copy of the ispconfig database in the root folder
    $backup_db_name = '/root/ispconfig_db_backup_'.@date('Y-m-d_h-i').'.sql';
    if(isset($conf['backup_path'])) {
        $backup_db_name = $conf['backup_path'].'/ispconfig_db_backup.sql';
    } else {
        $backup_db_name = '/root/ispconfig_db_backup_'.@date('Y-m-d_H-i').'.sql';
    }
    copy('existing_db.sql',$backup_db_name);
    chmod($backup_db_name, 0700);
    chown($backup_db_name, 'root');
install/update.php
@@ -123,6 +123,27 @@
echo "This application will update ISPConfig 3 on your server.\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/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");
    swriteln('Creating backup of /etc directory...');
    exec("tar pcfz $backup_path/etc.tar.gz /etc");
    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');
interface/web/admin/form/server_ip.tform.php
@@ -100,9 +100,9 @@
            'formtype'    => 'SELECT',
            'default'    => '',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
                                        'querystring' => 'SELECT client_id,CONCAT(company_name,' :: ',username) as name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
                                        'keyfield'=> 'client_id',
                                        'valuefield'=> 'contact_name'
                                        'valuefield'=> 'name'
                                     ),
            'value'        => array(0 => ' ')
        ),