mirror of
https://github.com/moodle/moodle.git
synced 2025-05-02 14:28:30 +02:00
MDL-10607 - support single quotes in db user/password in installer
merged from MOODLE_19_STABLE
This commit is contained in:
parent
392e73631e
commit
2961367e1e
13
install.php
13
install.php
@ -525,8 +525,9 @@ if ($nextstage == SAVE) {
|
||||
$str .= '$CFG->dbhost = \''.addslashes($INSTALL['dbhost'])."';\r\n";
|
||||
if (!empty($INSTALL['dbname'])) {
|
||||
$str .= '$CFG->dbname = \''.$INSTALL['dbname']."';\r\n";
|
||||
$str .= '$CFG->dbuser = \''.$INSTALL['dbuser']."';\r\n";
|
||||
$str .= '$CFG->dbpass = \''.$INSTALL['dbpass']."';\r\n";
|
||||
// support single quotes in db user/passwords
|
||||
$str .= '$CFG->dbuser = \''.addsingleslashes($INSTALL['dbuser'])."';\r\n";
|
||||
$str .= '$CFG->dbpass = \''.addsingleslashes($INSTALL['dbpass'])."';\r\n";
|
||||
}
|
||||
$str .= '$CFG->dbpersist = false;'."\r\n";
|
||||
$str .= '$CFG->prefix = \''.$INSTALL['prefix']."';\r\n";
|
||||
@ -1279,4 +1280,12 @@ function toggledbinfo() {
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Add slashes for single quotes so they can be
|
||||
* included in single quoted string
|
||||
*/
|
||||
function addsingleslashes($input){
|
||||
return str_replace("'", "\'", $input);
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user