]> git.mjollnir.org Git - moodle.git/commitdiff
Added new configuration value $CFG->directorypermissions to set the
authormoodler <moodler>
Mon, 20 Jan 2003 14:03:11 +0000 (14:03 +0000)
committermoodler <moodler>
Mon, 20 Jan 2003 14:03:11 +0000 (14:03 +0000)
permissions for new directories created in dataroot

lib/moodlelib.php
lib/setup.php

index e71c25468bb5a34e561e207938d26e436231325a..143d22343dba46aed82d58cc99203dbaadbbc1a7 100644 (file)
@@ -752,12 +752,13 @@ function make_upload_directory($directory) {
 
     $currdir = $CFG->dataroot;
 
+    umask(0000);
+
     if (!file_exists($currdir)) {
-        if (! mkdir($currdir, 0750)) {
+        if (! mkdir($currdir, $CFG->directorypermissions)) {
             notify("ERROR: You need to create the directory $currdir with web server write access");
             return false;
         }
-        chmod($currdir,0750);
     }
 
     $dirarray = explode("/", $directory);
@@ -765,11 +766,10 @@ function make_upload_directory($directory) {
     foreach ($dirarray as $dir) {
         $currdir = "$currdir/$dir";
         if (! file_exists($currdir)) {
-            if (! mkdir($currdir, 0750)) {
+            if (! mkdir($currdir, $CFG->directorypermissions)) {
                 notify("ERROR: Could not find or create a directory ($currdir)");
                 return false;
             }
-            chmod($currdir,0750);
         }
     }
 
index 17cecc9b99898f1d7320f4f0c5eaa66f3d5d5506..0c84d01bcb9aa73ea99a7aa1f48554993f430aa9 100644 (file)
     error_reporting($CFG->debug);   
 
 
+/// File permissions on created directories in the $CFG->dataroot
+
+    if (empty($CFG->directorypermissions)) {
+        $CFG->directorypermissions = 0777;      // Must be octal (that's why it's here)
+    }
+
+
 /// Location of standard files
 
     $CFG->wordlist    = "$CFG->libdir/wordlist.txt";