tbrehm
2008-12-20 f669291d8a32dd78f7fb2ab05470c7a5c7e402bf
install/lib/installer_base.lib.php
@@ -35,7 +35,7 @@
   var $db;
   public $conf;
   public $install_ispconfig_interface = true;
   public $is_update = false; // true if it is an update, falsi if it is a new install
    public function __construct()
@@ -227,18 +227,24 @@
         
         //* insert the ispconfig user in the remote server
         $from_host = $conf['hostname'];
         $from_ip = gethostbyname($conf['hostname']);
         
         //* username for the ispconfig user
         $conf['mysql']['master_ispconfig_user'] = 'ispconfigserver'.$conf['server_id'];
      
         //* Delete ISPConfig user in the local database, in case that it exists
         //* Delete ISPConfig user in the master database, in case that it exists
         $this->dbmaster->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['master_ispconfig_user']."' AND Host = '".$from_host."';");
         $this->dbmaster->query("DELETE FROM mysql.db WHERE Db = '".$conf['mysql']['master_database']."' AND Host = '".$from_host."';");
         $this->dbmaster->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['master_ispconfig_user']."' AND Host = '".$from_ip."';");
         $this->dbmaster->query("DELETE FROM mysql.db WHERE Db = '".$conf['mysql']['master_database']."' AND Host = '".$from_ip."';");
         $this->dbmaster->query('FLUSH PRIVILEGES;');
      
         //* Create the ISPConfig database user in the local database
           $query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['master_database'].".* "
                   ."TO '".$conf['mysql']['master_ispconfig_user']."'@'".$from_host."' "
                   ."IDENTIFIED BY '".$conf['mysql']['master_ispconfig_password']."';";
         $query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['master_database'].".* "
                   ."TO '".$conf['mysql']['master_ispconfig_user']."'@'".$from_ip."' "
                   ."IDENTIFIED BY '".$conf['mysql']['master_ispconfig_password']."';";
         if(!$this->dbmaster->query($query)) {
            $this->error('Unable to create database user in master database: '.$conf['mysql']['master_ispconfig_user'].' Error: '.$this->dbmaster->errorMessage);
@@ -878,6 +884,7 @@
      
      if($conf['mysql']['master_slave_setup'] == 'y') {
         $this->dbmaster->query($sql);
         $this->db->query($sql);
      } else {
         $this->db->query($sql);
      }
@@ -932,13 +939,11 @@
      caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
      
      //* Copy the ISPConfig vhost for the controlpanel
        // TODO: These are missing! should they be "vhost_dist_*_dir" ?
        $vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
        $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
        
        
        // Dont just copy over the virtualhost template but add some custom settings
        $content = rf("tpl/apache_ispconfig.vhost.master");
      $content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
      
@@ -953,7 +958,7 @@
      
      //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
      //* and create the symlink
      if($this->install_ispconfig_interface == true) {
      if($this->install_ispconfig_interface == true && $this->is_update == false) {
         if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
         if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
            exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");