Skip to content

Commit

Permalink
Merge branch 'MDL-39505-migrate-file-backport_24' of git://github.com…
Browse files Browse the repository at this point in the history
…/mudrd8mz/moodle into MOODLE_24_STABLE
  • Loading branch information
Sam Hemelryk committed Jun 11, 2013
2 parents c1dfb62 + d4eb62d commit 2a31efe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions backup/converter/moodle1/lib.php
Expand Up @@ -1210,12 +1210,16 @@ public function __construct(moodle1_converter $converter, $contextid = null, $co
*/
public function migrate_file($sourcepath, $filepath = '/', $filename = null, $sortorder = 0, $timecreated = null, $timemodified = null) {

$sourcefullpath = $this->basepath.'/'.$sourcepath;
// Normalise Windows paths a bit.
$sourcepath = str_replace('\\', '/', $sourcepath);

if ($sourcefullpath !== clean_param($sourcefullpath, PARAM_PATH)) {
throw new moodle1_convert_exception('file_invalid_path', $sourcefullpath);
// PARAM_PATH must not be used on full OS path!
if ($sourcepath !== clean_param($sourcepath, PARAM_PATH)) {
throw new moodle1_convert_exception('file_invalid_path', $sourcepath);
}

$sourcefullpath = $this->basepath.'/'.$sourcepath;

if (!is_readable($sourcefullpath)) {
throw new moodle1_convert_exception('file_not_readable', $sourcefullpath);
}
Expand Down

0 comments on commit 2a31efe

Please sign in to comment.