MDL-18200 installer - create dataroot dir if possible
authorstronk7 <stronk7>
Wed, 11 Feb 2009 16:16:52 +0000 (16:16 +0000)
committerstronk7 <stronk7>
Wed, 11 Feb 2009 16:16:52 +0000 (16:16 +0000)
install.php

index ed8060ad370cd994da376c4135bf0574882b11a3..e6661c453fbe234eeaf87bddf98f93e6bdcdae9f 100644 (file)
@@ -270,7 +270,22 @@ if ($config->stage == INSTALL_DOWNLOADLANG) {
         $hint_dataroot = get_string('pathsunsecuredataroot', 'install');
         $config->stage = INSTALL_PATHS;
 
-    } else if (!is_writable($CFG->dataroot)) {
+    } else if (!file_exists($CFG->dataroot)) {
+        $a = new stdClass();
+        $a->parent = dirname($CFG->dataroot);
+        $a->dataroot = $CFG->dataroot;
+        if (!is_writable(dirname($CFG->dataroot))) {
+            $hint_dataroot = get_string('pathsroparentdataroot', 'install', $a);
+            $config->stage = INSTALL_PATHS;
+        } else {
+            if (!make_upload_directory(false, false)) {
+                $hint_dataroot = get_string('pathserrcreatedataroot', 'install', $a);
+                $config->stage = INSTALL_PATHS;
+            }
+        }
+    }
+
+    if (empty($hint_dataroot) and !is_writable($CFG->dataroot)) {
         $hint_dataroot = get_string('pathsrodataroot', 'install');
         $config->stage = INSTALL_PATHS;
     }