]> git.mjollnir.org Git - moodle.git/commitdiff
debug off level is now 5 instead of 7 to prevent E_WARNING on production sites SC#294
authorskodak <skodak>
Tue, 22 Aug 2006 22:19:58 +0000 (22:19 +0000)
committerskodak <skodak>
Tue, 22 Aug 2006 22:19:58 +0000 (22:19 +0000)
install.php

index 67dbab713119612177f3aa187a1cb754ee86331e..ef436f9c8cf5b3a212a31d589b2357a4b48a5b2c 100644 (file)
@@ -141,10 +141,19 @@ $INSTALL['release'] = $release;
 /// Have the $db object ready because we are going to use it often
 $db = &ADONewConnection($INSTALL['dbtype']);
 
-/// guess the www root
+/// guess the www root and secure dataroot
 if ($INSTALL['wwwroot'] == '') {
     list($INSTALL['wwwroot'], $xtra) = explode('/install.php', qualified_me());
     $INSTALL['wwwrootform'] = $INSTALL['wwwroot'];
+
+    // now count slashes and treverse dirroot to get one level above web root
+    $up = preg_match_all('/\//', $INSTALL['wwwroot'], $matches) - 1;
+    $CFG->dataroot = $CFG->dirroot;
+    for ($i=0; $i<$up; $i++) {
+        $CFG->dataroot = dirname($CFG->dataroot);
+    }
+    $CFG->dataroot .= '/moodledata';
+    $INSTALL['dataroot'] = $CFG->dataroot;
 }
 
 $headstagetext = array(WELCOME       => get_string('chooselanguagehead', 'install'),