From: skodak Date: Sat, 7 Feb 2009 15:06:20 +0000 (+0000) Subject: MDL-18167 allow distro packs skip dbtype selection X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5167827bbbaf27ced1669a803b2be80acf1164d4;p=moodle.git MDL-18167 allow distro packs skip dbtype selection --- diff --git a/install.php b/install.php index 7654f091ad..2e1b7d832b 100644 --- a/install.php +++ b/install.php @@ -63,6 +63,9 @@ if (!empty($_POST)) { if (isset($_POST['previous'])) { $config->stage--; + if (INSTALL_DATABASETYPE and !empty($distro->dbtype)) { + $config->stage--; + } if ($config->stage == INSTALL_ENVIRONMENT or $config->stage == INSTALL_DOWNLOADLANG) { $config->stage--; } @@ -89,7 +92,7 @@ if (!empty($_POST)) { } else { $config->stage = INSTALL_WELCOME; - $config->dbtype = ''; + $config->dbtype = empty($distro->dbtype) ? '' : $distro->dbtype; // let distro packagings skip dbtype selection $config->dbhost = 'localhost'; $config->dbuser = ''; $config->dbpass = ''; @@ -261,6 +264,50 @@ if ($config->stage == INSTALL_SAVE) { +if ($config->stage == INSTALL_DOWNLOADLANG) { + if (empty($CFG->dataroot)) { + $config->stage = INSTALL_PATHS; + + } else if (is_dataroot_insecure()) { + $hint_dataroot = get_string('pathsunsecuredataroot', 'install'); + $config->stage = INSTALL_PATHS; + + } else if (!is_writable($CFG->dataroot)) { + $hint_dataroot = get_string('pathsrodataroot', 'install'); + $config->stage = INSTALL_PATHS; + } + + if ($config->dirroot === '' or !file_exists($config->dirroot)) { + $hint_dirroot = get_string('pathswrongdirroot', 'install'); + $config->stage = INSTALL_PATHS; + } + + if ($config->admin === '' or !file_exists($config->dirroot.'/'.$config->admin.'/environment.xml')) { + $hint_admindir = get_string('pathswrongadmindir', 'install'); + $config->stage = INSTALL_PATHS; + } +} + + + +if ($config->stage == INSTALL_DOWNLOADLANG) { + // no need to download anything if en lang selected + if ($CFG->lang == 'en_utf8') { + $config->stage = INSTALL_DATABASETYPE; + } +} + + + +if ($config->stage == INSTALL_DATABASETYPE) { + // skip db selection if distro package supports only one db + if (!empty($distro->dbtype)) { + $config->stage = INSTALL_DATABASE; + } +} + + + if ($config->stage == INSTALL_DATABASE) { $database = moodle_database::get_driver_instance($config->dbtype, 'native'); @@ -313,40 +360,6 @@ if ($config->stage == INSTALL_DATABASE) { -if ($config->stage == INSTALL_DOWNLOADLANG) { - if (empty($CFG->dataroot)) { - $config->stage = INSTALL_PATHS; - - } else if (is_dataroot_insecure()) { - $hint_dataroot = get_string('pathsunsecuredataroot', 'install'); - $config->stage = INSTALL_PATHS; - - } else if (!is_writable($CFG->dataroot)) { - $hint_dataroot = get_string('pathsrodataroot', 'install'); - $config->stage = INSTALL_PATHS; - } - - if ($config->dirroot === '' or !file_exists($config->dirroot)) { - $hint_dirroot = get_string('pathswrongdirroot', 'install'); - $config->stage = INSTALL_PATHS; - } - - if ($config->admin === '' or !file_exists($config->dirroot.'/'.$config->admin.'/environment.xml')) { - $hint_admindir = get_string('pathswrongadmindir', 'install'); - $config->stage = INSTALL_PATHS; - } -} - - - -if ($config->stage == INSTALL_DOWNLOADLANG) { - if ($CFG->lang == 'en_utf8') { - $config->stage = INSTALL_DATABASETYPE; - } -} - - - if ($config->stage == INSTALL_DOWNLOADLANG) { $downloaderror = '';