diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 44348f0335d..90ade414a31 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2542,15 +2542,14 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2020072300.01); } - if ($oldversion < 2020081400.01) { + if ($oldversion < 2020081400.02) { // Delete all user evidence files from users that have been deleted. $sql = "SELECT DISTINCT f.* FROM {files} f LEFT JOIN {context} c ON f.contextid = c.id - LEFT JOIN {user} u ON c.instanceid = u.id WHERE f.component = :component AND f.filearea = :filearea - AND u.deleted = 1"; + AND c.id IS NULL"; $stalefiles = $DB->get_records_sql($sql, ['component' => 'core_competency', 'filearea' => 'userevidence']); $fs = get_file_storage(); @@ -2558,7 +2557,7 @@ function xmldb_main_upgrade($oldversion) { $fs->get_file_instance($stalefile)->delete(); } - upgrade_main_savepoint(true, 2020081400.01); + upgrade_main_savepoint(true, 2020081400.02); } return true; diff --git a/version.php b/version.php index fcd47b79d12..44b293ad858 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2020081400.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2020081400.02; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.0dev (Build: 20200814)'; // Human-friendly version name