Skip to content

Commit 8f35cdb

Browse files
author
Marius Burkard
committed
- prevent running update when mysql cannot be used from command line with credentials from mysql_clientdb.conf
1 parent 548c70c commit 8f35cdb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

install/update.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,22 @@
293293
*/
294294
checkDbHealth();
295295

296+
297+
/*
298+
* Check command line mysql login
299+
*/
300+
if( !empty($conf["mysql"]["admin_password"]) ) {
301+
$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." -D ".escapeshellarg($conf['mysql']['database'])." -e ". escapeshellarg('SHOW DATABASES');
302+
} else {
303+
$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -P ".escapeshellarg($conf['mysql']['port'])." -D ".escapeshellarg($conf['mysql']['database'])." -e ". escapeshellarg('SHOW DATABASES');
304+
}
305+
$retval = 0;
306+
$retout = array();
307+
exec($cmd, $retout, $retval);
308+
if($retval != 0) {
309+
die("Unable to call mysql command line with credentials from mysql_clientdb.conf\n");
310+
}
311+
296312
/*
297313
* dump the new Database and reconfigure the server.ini
298314
*/

0 commit comments

Comments
 (0)