added multiple clear type support

This commit is contained in:
Andy Miller
2015-08-06 16:16:18 -06:00
parent 0afd00c789
commit 7b3e300e87

View File

@@ -289,11 +289,21 @@ class AdminController
*/
protected function taskClearCache()
{
$valid_clear_types = ['standard', 'all', 'assets-only', 'images-only', 'cache-only'];
if (!$this->authoriseTask('clear cache', ['admin.cache', 'admin.super'])) {
return;
}
$results = Cache::clearCache('standard');
$clear_type = $this->grav['uri']->param('cleartype');
if ($clear_type && in_array($clear_type, $valid_clear_types)) {
$clear = $clear_type;
} else {
$clear = $valid_clear_types[0];
}
$results = Cache::clearCache($clear);
if (count($results) > 0) {
$this->admin->json_response = ['status' => 'success', 'message' => 'Cache cleared'];
} else {