MDL-73317 restore: Reset navcache before closing session

As part of a restore, the session is closed early so it does not
interrupt the users session during the restore.

Currently the restore controller rebuilds the course caches while
restoring. This inadvertently resets the navcache, which would edit the
session despite it being closed.

Because this tracker now adds logging for this behaviour, it means
restoring now outputs a debugging message as a warning.

To resolve the debugging message, the navcache is now reset just before
closing the session. This is allowed, since the caches are designed
to be volatile.
This commit is contained in:
Matthew Hilton
2023-02-09 12:03:49 +10:00
parent 863bad8d7e
commit 49c4cfb2d5
@@ -384,6 +384,9 @@ class restore_controller extends base_controller {
// Release the session so other tabs in the same session are not blocked.
if ($this->get_releasesession() === backup::RELEASESESSION_YES) {
// Preemptively reset the navcache before closing, so it remains the same on shutdown.
navigation_cache::destroy_volatile_caches();
\core\session\manager::write_close();
}