From: stronk7 Date: Mon, 9 Feb 2009 19:35:57 +0000 (+0000) Subject: MDL-18198 installer - change distro to distrolib.php and delete distro hack from... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=768408e8dd4c19013fb9db0b328fc1472898d083;p=moodle.git MDL-18198 installer - change distro to distrolib.php and delete distro hack from installlib --- diff --git a/install.php b/install.php index 7cee92d2e8..ed8060ad37 100644 --- a/install.php +++ b/install.php @@ -42,8 +42,11 @@ require dirname(__FILE__).'/lib/installlib.php'; // distro specific customisation $distro = null; -if (file_exists('install/distro.php')) { - include('install/distro.php'); +if (file_exists('install/distrolib.php')) { + require_once('install/distrolib.php'); + if (function_exists('distro_get_config')) { + $distro = distro_get_config(); + } } $config = new stdClass(); @@ -187,7 +190,10 @@ if ($config->stage == INSTALL_SAVE) { if (!$database->driver_installed()) { $config->stage = INSTALL_DATABASETYPE; } else { - $hint_database = install_db_validate($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersit'=>0, 'dbsocket'=>$config->dbsocket), $distro); + if (function_exists('distro_pre_create_db')) { /// Hook for distros needing to do something before DB creation + $distro = distro_pre_create_db($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersit'=>0, 'dbsocket'=>$config->dbsocket), $distro); + } + $hint_database = install_db_validate($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersit'=>0, 'dbsocket'=>$config->dbsocket)); if ($hint_database === '') { $configphp = '\n"; } -function install_db_validate($database, $dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions, $distro) { +function install_db_validate($database, $dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions) { // 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);