Skip to content

Commit

Permalink
MDL-57649 mod_lesson: Additional refinement to upgrade script.
Browse files Browse the repository at this point in the history
  • Loading branch information
abgreeve committed Jul 19, 2017
1 parent 95d8e61 commit 23e2a9c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mod/lesson/db/upgrade.php
Expand Up @@ -148,9 +148,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 23e2a9c

Please sign in to comment.