MDL-65492 cache admin: make it easier to purge a cache repeatedly
This can be a big time-saver, e.g. during development.
This commit is contained in:
Vendored
+17
-4
@@ -208,8 +208,8 @@ if (!empty($action) && confirm_sesskey()) {
|
||||
break;
|
||||
|
||||
case 'purgedefinition': // Purge a specific definition.
|
||||
$definition = required_param('definition', PARAM_SAFEPATH);
|
||||
list($component, $area) = explode('/', $definition, 2);
|
||||
$id = required_param('definition', PARAM_SAFEPATH);
|
||||
list($component, $area) = explode('/', $id, 2);
|
||||
$factory = cache_factory::instance();
|
||||
$definition = $factory->create_definition($component, $area);
|
||||
if ($definition->has_required_identifiers()) {
|
||||
@@ -219,14 +219,27 @@ if (!empty($action) && confirm_sesskey()) {
|
||||
// Alrighty we can purge just the data belonging to this definition.
|
||||
cache_helper::purge_by_definition($component, $area);
|
||||
}
|
||||
redirect($PAGE->url, get_string('purgedefinitionsuccess', 'cache'), 5);
|
||||
|
||||
$message = get_string('purgexdefinitionsuccess', 'cache', [
|
||||
'name' => $definition->get_name(),
|
||||
'component' => $component,
|
||||
'area' => $area,
|
||||
]);
|
||||
$purgeagainlink = html_writer::link(new moodle_url('/cache/admin.php', [
|
||||
'action' => 'purgedefinition', 'sesskey' => sesskey(), 'definition' => $id]),
|
||||
get_string('purgeagain', 'cache'));
|
||||
redirect($PAGE->url, $message . ' ' . $purgeagainlink, 5);
|
||||
break;
|
||||
|
||||
case 'purgestore':
|
||||
case 'purge': // Purge a store cache.
|
||||
$store = required_param('store', PARAM_TEXT);
|
||||
cache_helper::purge_store($store);
|
||||
redirect($PAGE->url, get_string('purgestoresuccess', 'cache'), 5);
|
||||
$message = get_string('purgexstoresuccess', 'cache', ['store' => $store]);
|
||||
$purgeagainlink = html_writer::link(new moodle_url('/cache/admin.php', [
|
||||
'action' => 'purgestore', 'sesskey' => sesskey(), 'store' => $store]),
|
||||
get_string('purgeagain', 'cache'));
|
||||
redirect($PAGE->url, $message . ' ' . $purgeagainlink, 5);
|
||||
break;
|
||||
|
||||
case 'newlockinstance':
|
||||
|
||||
+7
-2
@@ -141,8 +141,9 @@ $string['plugin'] = 'Plugin';
|
||||
$string['pluginsummaries'] = 'Installed cache stores';
|
||||
$string['privacy:metadata:cachestore'] = 'The Cache subsystem stores data temporarily on behalf of other parts of Moodle. This data is not easily identifiable, and is very short lived. It serves as a cache of data stored elsewhere in Moodle, and should therefore already be handled by those Moodle components.';
|
||||
$string['purge'] = 'Purge';
|
||||
$string['purgedefinitionsuccess'] = 'Successfully purged the requested definition.';
|
||||
$string['purgestoresuccess'] = 'Successfully purged the requested store.';
|
||||
$string['purgeagain'] = 'Purge again';
|
||||
$string['purgexdefinitionsuccess'] = 'Successfully purged the "{$a->name}" cache ({$a->component}/{$a->area}).';
|
||||
$string['purgexstoresuccess'] = 'Successfully purged the "{$a->store}" store.';
|
||||
$string['requestcount'] = 'Test with {$a} requests';
|
||||
$string['rescandefinitions'] = 'Rescan definitions';
|
||||
$string['result'] = 'Result';
|
||||
@@ -190,3 +191,7 @@ $string['unsupportedmode'] = 'Unsupported mode';
|
||||
$string['untestable'] = 'Untestable';
|
||||
$string['userinputsharingkey'] = 'Custom key for sharing';
|
||||
$string['userinputsharingkey_help'] = 'Enter your own private key here. When you set up other stores on other sites you wish to share data with make sure you set the exact same key there.';
|
||||
|
||||
// Deprecated since Moodle 3.8.
|
||||
$string['purgedefinitionsuccess'] = 'Successfully purged the requested definition.';
|
||||
$string['purgestoresuccess'] = 'Successfully purged the requested store.';
|
||||
|
||||
@@ -158,3 +158,5 @@ backpackbadges,core_badges
|
||||
nobackpackbadges,core_badges
|
||||
nobackpackcollections,core_badges
|
||||
error:nogroups,core_badges
|
||||
purgedefinitionsuccess,core_cache
|
||||
purgestoresuccess,core_cache
|
||||
|
||||
Reference in New Issue
Block a user