Merge branch 'MDL-61766-master' of git://github.com/junpataleta/moodle
This commit is contained in:
@@ -234,7 +234,14 @@ class xmldb_structure extends xmldb_object {
|
||||
// Normalize paths to compare them.
|
||||
$filepath = realpath($this->name); // File path comes in name.
|
||||
$filename = basename($filepath);
|
||||
$structurepath = realpath($CFG->dirroot . DIRECTORY_SEPARATOR . $this->path . DIRECTORY_SEPARATOR . $filename);
|
||||
$normalisedpath = $this->path;
|
||||
if ($CFG->admin !== 'admin') {
|
||||
$needle = 'admin/';
|
||||
if (strpos($this->path, $needle) === 0) {
|
||||
$normalisedpath = substr_replace($this->path, "$CFG->admin/", 0, strlen($needle));
|
||||
}
|
||||
}
|
||||
$structurepath = realpath($CFG->dirroot . DIRECTORY_SEPARATOR . $normalisedpath . DIRECTORY_SEPARATOR . $filename);
|
||||
if ($filepath !== $structurepath) {
|
||||
$relativepath = dirname(str_replace(realpath($CFG->dirroot) . DIRECTORY_SEPARATOR, '', $filepath));
|
||||
$this->errormsg = 'PATH attribute does not match file directory: ' . $relativepath;
|
||||
|
||||
Reference in New Issue
Block a user