Marius Cramer
2015-08-06 37b29231e47a0c4458dc1c15d98588f16f07e1e2
install/update.php
@@ -247,13 +247,15 @@
   $finished = false;
   do {
      $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname');
      $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port');
      $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user');    
      $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password');
      $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database');
      //* Initialize the MySQL server connection
      if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
      if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
         $conf['mysql']['master_host'] = $tmp_mysql_server_host;
         $conf['mysql']['master_port'] = $tmp_mysql_server_port;
         $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
         $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
         $conf['mysql']['master_database'] = $tmp_mysql_server_database;
@@ -267,10 +269,8 @@
   // initialize the connection to the master database
   $inst->dbmaster = new db();
   if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
   $inst->dbmaster->dbHost = $conf['mysql']["master_host"];
   $inst->dbmaster->dbName = $conf['mysql']["master_database"];
   $inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
   $inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
   $inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"]);
   $inst->dbmaster->setDBName($conf['mysql']["master_database"]);
} else {
   $inst->dbmaster = $inst->db;
}
@@ -342,8 +342,10 @@
      $inst->configure_spamassassin();
      //** Configure Amavis
      swriteln('Configuring Amavisd');
      $inst->configure_amavis();
      if($conf['amavis']['installed'] == true) {
         swriteln('Configuring Amavisd');
         $inst->configure_amavis();
      }
      //** Configure Getmail
      swriteln('Configuring Getmail');
@@ -390,6 +392,11 @@
      $inst->configure_apps_vhost();
   }
    if($conf['services']['xmpp']) {
        //** Configure Metronome XMPP
        $inst->configure_xmpp('dont-create-certs');
    }
   //* Configure DBServer
   swriteln('Configuring Database');
@@ -397,10 +404,15 @@
   if($conf['services']['firewall']) {
      if($conf['bastille']['installed'] == true) {
      if($conf['ufw']['installed'] == true) {
         //* Configure Ubuntu Firewall
         $conf['services']['firewall'] = true;
         swriteln('Configuring Ubuntu Firewall');
         $inst->configure_ufw_firewall();
      } else {
         //* Configure Bastille Firewall
         swriteln('Configuring Bastille Firewall');
         $inst->configure_firewall();
         $inst->configure_bastille_firewall();
      }
   }
@@ -443,6 +455,9 @@
$inst->install_ispconfig();
// Cleanup
$inst->cleanup_ispconfig();
//** Configure Crontab
$update_crontab_answer = $inst->simple_query('Reconfigure Crontab?', array('yes', 'no'), 'yes','reconfigure_crontab');
if($update_crontab_answer == 'yes') {
@@ -453,7 +468,7 @@
//** Restart services:
if($reconfigure_services_answer == 'yes') {
   swriteln('Restarting services ...');
   if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart'));
   if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1');
   if($conf['services']['mail']) {
      if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
      if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart'));
@@ -484,16 +499,30 @@
      if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null');
   }
    if($conf['services']['xmpp']) {
        if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null');
    }
   if($conf['services']['proxy']) {
      // if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script']))     system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
      if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');
   }
   if($conf['services']['firewall']) {
      //if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['ufw']['init_script']))     system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
      if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['ufw']['init_script']))     system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
   }
}
//* Set default servers
setDefaultServers();
$inst->create_mount_script();
//* Create md5 filelist
$md5_filename = '/usr/local/ispconfig/security/data/file_checksums_'.date('Y-m-d_h-i').'.md5';
exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename);
chmod($md5_filename,0700);
echo "Update finished.\n";
?>