MDL-36977 Be more picky when it comes to migrating files in moodle1 backups

This commit is contained in:
David Mudrák 2013-01-07 22:21:08 +01:00 committed by Dan Poltawski
parent 7b66137f7b
commit 0ab681d3e7

View File

@ -642,7 +642,9 @@ class moodle1_converter extends base_converter {
}
foreach ($matches[2] as $match) {
$file = str_replace(array('$@FILEPHP@$', '$@SLASH@$', '$@FORCEDOWNLOAD@$'), array('', '/', ''), $match);
$files[] = rawurldecode($file);
if ($file === clean_param($file, PARAM_PATH)) {
$files[] = rawurldecode($file);
}
}
return array_unique($files);
@ -1210,6 +1212,10 @@ class moodle1_file_manager implements loggable {
$sourcefullpath = $this->basepath.'/'.$sourcepath;
if ($sourcefullpath !== clean_param($sourcefullpath, PARAM_PATH)) {
throw new moodle1_convert_exception('file_invalid_path', $sourcefullpath);
}
if (!is_readable($sourcefullpath)) {
throw new moodle1_convert_exception('file_not_readable', $sourcefullpath);
}