MDL-70142 admin: preserve selected cache definitions in the form.

By not redirecting when we are already on the purge caches page we
can preserve the submitted form data, allowing users to easily
repeat the previous action.
This commit is contained in:
Paul Holden
2021-03-26 13:09:33 +00:00
parent d65ed58e73
commit 0c6ea21bac
+7 -1
View File
@@ -52,8 +52,14 @@ if ($data = $form->get_data()) {
$message = get_string('purgecachesfinished', 'admin');
}
// Redirect and/or show notification message confirming cache(s) were purged.
if (isset($message)) {
redirect($returnurl, $message);
if (!$PAGE->url->compare($returnurl, URL_MATCH_BASE)) {
redirect($returnurl, $message);
}
// We are already on the purge caches page, add the notification.
\core\notification::add($message, \core\output\notification::NOTIFY_INFO);
}
// Otherwise, show a form to actually purge the caches.