Skip to content

Commit

Permalink
MDL-18167 allow distro packs skip dbtype selection
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Feb 7, 2009
1 parent 5c1fb7d commit 5167827
Showing 1 changed file with 48 additions and 35 deletions.
83 changes: 48 additions & 35 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@

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--;
}
Expand All @@ -89,7 +92,7 @@
} 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 = '';
Expand Down Expand Up @@ -261,6 +264,50 @@



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');

Expand Down Expand Up @@ -313,40 +360,6 @@



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 = '';

Expand Down

0 comments on commit 5167827

Please sign in to comment.