mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-74032 core_cache: Coding error before upgrade with versioned cache
In certain cases where it doesn't already redirect to run the upgrade, users could see an exception 'Unexpectedly found non-versioned cache entry'. This change ensures the upgrade happens instead.
This commit is contained in:
parent
1d99ba19a2
commit
3776b5542f
11
cache/classes/loaders.php
vendored
11
cache/classes/loaders.php
vendored
@ -510,11 +510,16 @@ class cache implements cache_loader {
|
||||
try {
|
||||
$validversion = self::check_version($result, $requiredversion);
|
||||
} catch (\coding_exception $e) {
|
||||
// If we get an exception because there is incorrect data in the cache (not
|
||||
// In certain circumstances this could happen before users are taken to the upgrade
|
||||
// screen when upgrading from an earlier Moodle version that didn't use a versioned
|
||||
// cache for this item, so redirect instead of showing error if that's the case.
|
||||
redirect_if_major_upgrade_required();
|
||||
|
||||
// If we still get an exception because there is incorrect data in the cache (not
|
||||
// versioned when it ought to be), delete it so this exception goes away next time.
|
||||
// The exception should only happen if there is a code bug (which is why we still
|
||||
// throw it) but there are unusual scenarios where it might happen and that would
|
||||
// be annoying if it doesn't fix itself.
|
||||
// throw it) but there are unusual scenarios in development where it might happen
|
||||
// and that would be annoying if it doesn't fix itself.
|
||||
$this->store->delete($parsedkey);
|
||||
throw $e;
|
||||
}
|
||||
|
@ -1423,7 +1423,7 @@ function disable_output_buffering() {
|
||||
*/
|
||||
function is_major_upgrade_required() {
|
||||
global $CFG;
|
||||
$lastmajordbchanges = 2021101900.01;
|
||||
$lastmajordbchanges = 2022022200.00;
|
||||
|
||||
$required = empty($CFG->version);
|
||||
$required = $required || (float)$CFG->version < $lastmajordbchanges;
|
||||
|
Loading…
x
Reference in New Issue
Block a user