Skip to content

Commit

Permalink
MDL-37470 cache: definitions can now be purged through config screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Jan 27, 2013
1 parent b3778a0 commit 5052356
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion cache/admin.php
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion cache/locallib.php
Expand Up @@ -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()))
)
);
}
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lang/en/cache.php
Expand Up @@ -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';
Expand Down

0 comments on commit 5052356

Please sign in to comment.