mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-18167 more hooks for distros
This commit is contained in:
parent
4f9dba35a3
commit
6724b0598b
2 changed files with 23 additions and 6 deletions
|
@ -57,8 +57,22 @@ function install_helpbutton($url, $title='') {
|
|||
echo "</a>\n";
|
||||
}
|
||||
|
||||
function install_db_validate($database, $dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions) {
|
||||
function install_db_validate($database, $dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions, $distro) {
|
||||
// this is in function because we want the /install.php to parse in PHP4
|
||||
|
||||
if ($database->get_dbfamily() === 'mysql' and !empty($distro->setdbrootpassword) and $dbpass !== '') {
|
||||
// distro hack - set root password
|
||||
try {
|
||||
if ($database->connect($dbhost, $dbuser, '', $dbname, $prefix, $dboptions)) {
|
||||
$sql = "UPDATE user SET password=password(?) WHERE user='root'";
|
||||
$params = array($dbpass);
|
||||
$database->execute($sql, $params);
|
||||
return '';
|
||||
}
|
||||
} catch (Exception $ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
$database->connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue