]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18167 allow distro packs skip dbtype selection
authorskodak <skodak>
Sat, 7 Feb 2009 15:06:20 +0000 (15:06 +0000)
committerskodak <skodak>
Sat, 7 Feb 2009 15:06:20 +0000 (15:06 +0000)
install.php

index 7654f091ad728cd3d6960faec26bec5e929bc729..2e1b7d832b1e243d7657dc39998e22506e8b5bff 100644 (file)
@@ -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 = '';