From cbac12c434554a716bad982e1ebd1ba89f94d789 Mon Sep 17 00:00:00 2001 From: Lubomir Stork Date: Fri, 7 May 2010 11:19:40 +0200 Subject: [PATCH] Implementing cleanup of cache engines --- libs/clear_cache.php | 16 ++++++++++++++++ vendors/shells/clear_cache.php | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/libs/clear_cache.php b/libs/clear_cache.php index 31445fc..d9bb865 100644 --- a/libs/clear_cache.php +++ b/libs/clear_cache.php @@ -2,6 +2,22 @@ class ClearCache { + public function engines($engines = array()) { + $result = array(); + + $keys = Cache::configured(); + + if ($engines) { + $keys = array_intersect($keys, $engines); + } + + foreach ($keys as $key) { + $result[$key] = Cache::clear(false, $key); + } + + return $result; + } + public function files($folders = array()) { $deleted = $error = array(); diff --git a/vendors/shells/clear_cache.php b/vendors/shells/clear_cache.php index 15dfa43..55cb9b3 100644 --- a/vendors/shells/clear_cache.php +++ b/vendors/shells/clear_cache.php @@ -6,6 +6,15 @@ class ClearCacheShell extends Shell { public function main() { $this->files(); + $this->engines(); + } + + public function engines() { + $output = $this->_Cleaner->engines($this->args); + + foreach ($output as $key => $result) { + $this->out($key . ': ' . ($result ? 'cleared' : 'error')); + } } public function files() {