From 7b3e300e8777a70da91812656030cf36d5a71f86 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 6 Aug 2015 16:16:18 -0600 Subject: [PATCH] added multiple clear type support --- classes/controller.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/classes/controller.php b/classes/controller.php index 59fe4168..8bd28bd3 100644 --- a/classes/controller.php +++ b/classes/controller.php @@ -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 {