When using safe_mode the is_dir() function might return a wrong result. My Moodle files are owned by www-data, the CFG->moodledata is in /var/local/moodledata. When checking is_dir('/var/') (like in lib/moodlelib.php:6771) PHP returns boolean(false); /var/ is owned by root and thus PHP returns false (for security reasons?!?). This results in errors when importing a course into another.
It might be better to strip off the CFG->moodledata before recursively checking and creating directories. This directory should already exist anyway when calling this method. It even saves some execution time.
Strip off CFG->moodledata (there might be another way that is more foolproof, this is just a quick workaround):
$dir = str_replace($CFG->dataroot.'/', '', $dir);
Start with $dir = CFG->dataroot:
$dir = $CFG->dataroot.'/';
See the patch for more information.
- has a non-specific relationship to
-
MDL-11912 Course Backups fails when including user files
-
- Closed
-