MDL-23792 fixing upgrade problem with missing pictures in mod/database
This commit is contained in:
@@ -123,9 +123,11 @@ function xmldb_data_upgrade($oldversion) {
|
||||
if ($content->type == 'picture') {
|
||||
// migrate thumb
|
||||
$filepath = "$CFG->dataroot/$content->course/$CFG->moddata/data/$content->dataid/$content->fieldid/$content->recordid/thumb/$content->content";
|
||||
if (!$fs->file_exists($context->id, 'mod_data', $filearea, $content->id, '/', 'thumb_'.$filename)) {
|
||||
$file_record['filename'] = 'thumb_'.$file_record['filename'];
|
||||
$fs->create_file_from_pathname($file_record, $filepath);
|
||||
if (file_exists($filepath)) {
|
||||
if (!$fs->file_exists($context->id, 'mod_data', $filearea, $content->id, '/', 'thumb_'.$filename)) {
|
||||
$file_record['filename'] = 'thumb_'.$file_record['filename'];
|
||||
$fs->create_file_from_pathname($file_record, $filepath);
|
||||
}
|
||||
unlink($filepath);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user