Skip to content

Commit f1b9899

Browse files
committed
FS#149 - error in expert installation
1 parent f94f455 commit f1b9899

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

install/install.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
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') {
225225
//* Create the mysql database
226226
$inst->configure_database();
227-
system('/etc/init.d/mysql restart');
227+
//system('/etc/init.d/mysql restart');
228228
}
229229

230230
//* Insert the Server record into the database

install/lib/installer_base.lib.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,17 @@ public function add_database_server_record() {
157157
$from_host = $conf['hostname'];
158158
}
159159

160+
// Delete ISPConfig user, in case that it exists
161+
$this->db->query("DELETE FROM mysql.user WHERE User = '".$cf['ispconfig_user']."' AND Host = '".$from_host."';");
162+
$this->db->query("DELETE FROM mysql.db WHERE Db = '".$cf['database']."' AND Host = '".$from_host."';");
163+
$this->db->query('FLUSH PRIVILEGES;');
164+
160165
//* Create the ISPConfig database user
161166
$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$cf['database'].".* "
162167
."TO '".$cf['ispconfig_user']."'@'".$from_host."' "
163168
."IDENTIFIED BY '".$cf['ispconfig_password']."';";
164169
if(!$this->db->query($query)) {
165-
$tmp = $this->db->queryOneRecord("SELECT * from mysql.user WHERE User = '".$cf['ispconfig_user']."' AND Host = '$from_host'");
166-
if($tmp["User"] == $cf['ispconfig_user']) {
167-
$this->db->query("UPDATE mysql.user SET `password` = PASSWORD('".$cf['ispconfig_password']."') WHERE User = '".$cf['ispconfig_user']."' AND Host = '$from_host'");
168-
} else {
169-
$this->error('Unable to create database user: '.$cf['ispconfig_user']);
170-
}
170+
$this->error('Unable to create database user: '.$cf['ispconfig_user'].' Error: '.$this->db->errorMessage);
171171
}
172172

173173
//* Reload database privelages

install/uninstall.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
// Delete the ISPConfig database
3535
// $app->db->query("DROP DATABASE '".$conf["db_database"]."'");
36-
$app->db->query("DELETE FROM mysql.user WHERE User = 'ispconfig'");
36+
// $app->db->query("DELETE FROM mysql.user WHERE User = 'ispconfig'");
3737

3838

3939
exec("/etc/init.d/mysql stop");
@@ -47,6 +47,8 @@
4747
// Delete the ispconfig files
4848
exec('rm -rf /usr/local/ispconfig');
4949

50+
echo "Please do not forget to delete the ispconfig user in the mysql.user table.\n\n";
51+
5052
echo "Finished.\n";
5153

5254
?>

0 commit comments

Comments
 (0)