mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-39505-migrate-file-backport_24' of git://github.com/mudrd8mz/moodle into MOODLE_24_STABLE
This commit is contained in:
commit
2a31efea1b
1 changed files with 7 additions and 3 deletions
|
@ -1210,12 +1210,16 @@ class moodle1_file_manager implements loggable {
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue