Skip to content

Commit

Permalink
Merge branch 'wip-MDL-57649-31-fix' of git://github.com/abgreeve/mood…
Browse files Browse the repository at this point in the history
…le into MOODLE_31_STABLE
  • Loading branch information
danpoltawski committed Jul 19, 2017
2 parents 62be5f6 + 9e1375f commit f06abbd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mod/lesson/db/upgrade.php
Expand Up @@ -394,9 +394,11 @@ function xmldb_lesson_upgrade($oldversion) {
FROM {files} f
LEFT JOIN {lesson_answers} la ON f.itemid = la.id
WHERE component = :component
AND (filearea = :fileareaanswer OR filearea = :filearearesponse)
AND la.id IS NULL";

$orphanedfiles = $DB->get_recordset_sql($sql, array('component' => 'mod_lesson'));
$orphanedfiles = $DB->get_recordset_sql($sql, array('component' => 'mod_lesson', 'fileareaanswer' => 'page_answers',
'filearearesponse' => 'page_responses'));
$fs = get_file_storage();
foreach ($orphanedfiles as $file) {
$fs->delete_area_files($file->contextid, $file->component, $file->filearea, $file->itemid);
Expand Down

0 comments on commit f06abbd

Please sign in to comment.