Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.2
-
Component/s: Backup
-
Labels:None
-
Environment:Linux (Debian Etch), Apache 2.2.3-4+etch1, PHP5 5.2.0-8+etch7 with safe_mode turned on
-
Affected Branches:MOODLE_18_STABLE
-
Fixed Branches:MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
Description
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.
Attachments
Issue Links
| This issue has a non-specific relationship to: | ||||
| MDL-11912 | Course Backups fails when including user files |
|
|
|
many other parts break in safe mode, I do not think it is supported officially when running moodle with safe mode enabled, is it Eloy?