Skip to content
Browse files

MDL-37470 cache: definitions can now be purged through config screen

  • Loading branch information...
1 parent b3778a0 commit 5052356574813655713ae123204b57a3b45000f4 @samhemelryk samhemelryk committed
Showing with 15 additions and 2 deletions.
  1. +9 −1 cache/admin.php
  2. +5 −1 cache/locallib.php
  3. +1 −0 lang/en/cache.php
View
10 cache/admin.php
@@ -129,7 +129,7 @@
}
break;
case 'editdefinitionmapping' : // Edit definition mappings.
- $definition = required_param('definition', PARAM_TEXT);
+ $definition = required_param('definition', PARAM_ALPHANUMEXT);
$title = get_string('editdefinitionmappings', 'cache', $definition);
$mform = new cache_definition_mappings_form($PAGE->url, array('definition' => $definition));
if ($mform->is_cancelled()) {
@@ -167,6 +167,14 @@
}
break;
+ case 'purgedefinition': // Purge a specific definition.
+ $definition = required_param('definition', PARAM_ALPHANUMEXT);
+ list($component, $area) = explode('/', $definition, 2);
+ cache_helper::purge_by_definition($component, $area);
+ redirect($PAGE->url, get_string('purgedefinitionsuccess', 'cache'), 5);
+ break;
+
+ case 'purgestore':
case 'purge': // Purge a store cache.
$store = required_param('store', PARAM_TEXT);
cache_helper::purge_store($store);
View
6 cache/locallib.php
@@ -695,6 +695,10 @@ public static function get_definition_actions(context $context) {
array(
'text' => get_string('editmappings', 'cache'),
'url' => new moodle_url('/cache/admin.php', array('action' => 'editdefinitionmapping', 'sesskey' => sesskey()))
+ ),
+ array(
+ 'text' => get_string('purge', 'cache'),
+ 'url' => new moodle_url('/cache/admin.php', array('action' => 'purgedefinition', 'sesskey' => sesskey()))
)
);
}
@@ -724,7 +728,7 @@ public static function get_store_instance_actions($name, array $storedetails) {
}
$actions[] = array(
'text' => get_string('purge', 'cache'),
- 'url' => new moodle_url($baseurl, array('action' => 'purge'))
+ 'url' => new moodle_url($baseurl, array('action' => 'purgestore'))
);
}
return $actions;
View
1 lang/en/cache.php
@@ -92,6 +92,7 @@
$string['plugin'] = 'Plugin';
$string['pluginsummaries'] = 'Installed cache stores';
$string['purge'] = 'Purge';
+$string['purgedefinitionsuccess'] = 'Successfully purged the requested definition.';
$string['purgestoresuccess'] = 'Successfully purged the requested store.';
$string['requestcount'] = 'Test with {$a} requests';
$string['rescandefinitions'] = 'Rescan definitions';

0 comments on commit 5052356

Please sign in to comment.
Something went wrong with that request. Please try again.