Skip to content

Commit 100d410

Browse files
author
vogelor
committed
Added more informations to the automatic install (to find a error, if there is one)
1 parent 7486c3d commit 100d410

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

install/autoupdate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
* If it is NOT a master-slave - Setup then we are at the Master-DB. So set all rights
170170
*/
171171
if($conf['mysql']['master_slave_setup'] != 'y') {
172-
$inst->grant_master_database_rights();
172+
$inst->grant_master_database_rights(true);
173173
}
174174

175175
/*

install/lib/installer_base.lib.php

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function add_database_server_record() {
298298

299299
}
300300

301-
public function grant_master_database_rights() {
301+
public function grant_master_database_rights($verbose = false) {
302302
global $conf;
303303

304304
/*
@@ -353,6 +353,9 @@ public function grant_master_database_rights() {
353353
*/
354354
if ($value['pwd'] != ''){
355355
$query = "CREATE USER '".$value['user']."'@'".$host."' IDENTIFIED BY '" . $value['pwd'] . "'";
356+
if ($verbose){
357+
echo "\n\n" . $query ."\n";
358+
}
356359
$this->dbmaster->query($query); // ignore the error
357360
}
358361

@@ -361,60 +364,96 @@ public function grant_master_database_rights() {
361364
* In Case that it will not exist, do nothing (ignore the error!)
362365
*/
363366
$query = "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '".$value['user']."'@'".$host."' ";
367+
if ($verbose){
368+
echo "\n\n" . $query ."\n";
369+
}
364370
$this->dbmaster->query($query); // ignore the error
365371

366372
//* Create the ISPConfig database user in the remote database
367373
$query = "GRANT SELECT ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
374+
if ($verbose){
375+
echo $query ."\n";
376+
}
368377
if(!$this->dbmaster->query($query)) {
369378
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
370379
}
371380

372381
$query = "GRANT SELECT, INSERT ON ".$value['db'].".`sys_log` TO '".$value['user']."'@'".$host."' ";
382+
if ($verbose){
383+
echo $query ."\n";
384+
}
373385
if(!$this->dbmaster->query($query)) {
374386
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
375387
}
376388

377389
$query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`sys_datalog` TO '".$value['user']."'@'".$host."' ";
390+
if ($verbose){
391+
echo $query ."\n";
392+
}
378393
if(!$this->dbmaster->query($query)) {
379394
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
380395
}
381396

382397
$query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`software_update_inst` TO '".$value['user']."'@'".$host."' ";
398+
if ($verbose){
399+
echo $query ."\n";
400+
}
383401
if(!$this->dbmaster->query($query)) {
384402
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
385403
}
386404

387405
$query = "GRANT SELECT, UPDATE(`updated`) ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
406+
if ($verbose){
407+
echo $query ."\n";
408+
}
388409
if(!$this->dbmaster->query($query)) {
389410
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
390411
}
391412

392413
$query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' ";
414+
if ($verbose){
415+
echo $query ."\n";
416+
}
393417
if(!$this->dbmaster->query($query)) {
394418
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
395419
}
396420

397421
$query = "GRANT SELECT ON ".$value['db'].".`sys_group` TO '".$value['user']."'@'".$host."' ";
422+
if ($verbose){
423+
echo $query ."\n";
424+
}
398425
if(!$this->dbmaster->query($query)) {
399426
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
400427
}
401428

402429
$query = "GRANT SELECT, UPDATE (`action_state`, `response`) ON ".$value['db'].".`sys_remoteaction` TO '".$value['user']."'@'".$host."' ";
430+
if ($verbose){
431+
echo $query ."\n";
432+
}
403433
if(!$this->dbmaster->query($query)) {
404434
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
405435
}
406436

407437
$query = "GRANT SELECT, INSERT , DELETE ON ".$value['db'].".`monitor_data` TO '".$value['user']."'@'".$host."' ";
438+
if ($verbose){
439+
echo $query ."\n";
440+
}
408441
if(!$this->dbmaster->query($query)) {
409442
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
410443
}
411444

412445
$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`mail_traffic` TO '".$value['user']."'@'".$host."' ";
446+
if ($verbose){
447+
echo $query ."\n";
448+
}
413449
if(!$this->dbmaster->query($query)) {
414450
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
415451
}
416452

417453
$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`web_traffic` TO '".$value['user']."'@'".$host."' ";
454+
if ($verbose){
455+
echo $query ."\n";
456+
}
418457
if(!$this->dbmaster->query($query)) {
419458
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
420459
}

0 commit comments

Comments
 (0)