Commit f1b98990 authored by tbrehm's avatar tbrehm
Browse files

FS#149 - error in expert installation

parent f94f455f
...@@ -224,7 +224,7 @@ if($install_mode == 'Standard') { ...@@ -224,7 +224,7 @@ if($install_mode == 'Standard') {
if(strtolower($inst->simple_query('Create a new database? (We do not want to join a existing ISPConfig server setup)',array('y','n'),'y')) == 'y') { if(strtolower($inst->simple_query('Create a new database? (We do not want to join a existing ISPConfig server setup)',array('y','n'),'y')) == 'y') {
//* Create the mysql database //* Create the mysql database
$inst->configure_database(); $inst->configure_database();
system('/etc/init.d/mysql restart'); //system('/etc/init.d/mysql restart');
} }
//* Insert the Server record into the database //* Insert the Server record into the database
......
...@@ -157,17 +157,17 @@ class installer_base { ...@@ -157,17 +157,17 @@ class installer_base {
$from_host = $conf['hostname']; $from_host = $conf['hostname'];
} }
// Delete ISPConfig user, in case that it exists
$this->db->query("DELETE FROM mysql.user WHERE User = '".$cf['ispconfig_user']."' AND Host = '".$from_host."';");
$this->db->query("DELETE FROM mysql.db WHERE Db = '".$cf['database']."' AND Host = '".$from_host."';");
$this->db->query('FLUSH PRIVILEGES;');
//* Create the ISPConfig database user //* Create the ISPConfig database user
$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$cf['database'].".* " $query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$cf['database'].".* "
."TO '".$cf['ispconfig_user']."'@'".$from_host."' " ."TO '".$cf['ispconfig_user']."'@'".$from_host."' "
."IDENTIFIED BY '".$cf['ispconfig_password']."';"; ."IDENTIFIED BY '".$cf['ispconfig_password']."';";
if(!$this->db->query($query)) { if(!$this->db->query($query)) {
$tmp = $this->db->queryOneRecord("SELECT * from mysql.user WHERE User = '".$cf['ispconfig_user']."' AND Host = '$from_host'"); $this->error('Unable to create database user: '.$cf['ispconfig_user'].' Error: '.$this->db->errorMessage);
if($tmp["User"] == $cf['ispconfig_user']) {
$this->db->query("UPDATE mysql.user SET `password` = PASSWORD('".$cf['ispconfig_password']."') WHERE User = '".$cf['ispconfig_user']."' AND Host = '$from_host'");
} else {
$this->error('Unable to create database user: '.$cf['ispconfig_user']);
}
} }
//* Reload database privelages //* Reload database privelages
......
...@@ -33,7 +33,7 @@ require("/usr/local/ispconfig/server/lib/app.inc.php"); ...@@ -33,7 +33,7 @@ require("/usr/local/ispconfig/server/lib/app.inc.php");
// Delete the ISPConfig database // Delete the ISPConfig database
// $app->db->query("DROP DATABASE '".$conf["db_database"]."'"); // $app->db->query("DROP DATABASE '".$conf["db_database"]."'");
$app->db->query("DELETE FROM mysql.user WHERE User = 'ispconfig'"); // $app->db->query("DELETE FROM mysql.user WHERE User = 'ispconfig'");
exec("/etc/init.d/mysql stop"); exec("/etc/init.d/mysql stop");
...@@ -47,6 +47,8 @@ unlink("/etc/apache2/sites-available/ispconfig.vhost"); ...@@ -47,6 +47,8 @@ unlink("/etc/apache2/sites-available/ispconfig.vhost");
// Delete the ispconfig files // Delete the ispconfig files
exec('rm -rf /usr/local/ispconfig'); exec('rm -rf /usr/local/ispconfig');
echo "Please do not forget to delete the ispconfig user in the mysql.user table.\n\n";
echo "Finished.\n"; echo "Finished.\n";
?> ?>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment