From 087c614f0c3d8ec8cb056b8570b4276ff00fc99c Mon Sep 17 00:00:00 2001 From: chris48s Date: Fri, 27 May 2016 20:58:46 +0100 Subject: [PATCH] Add warnings if cache engine is ApcEngine or WincacheEngine --- src/Shell/CacheShell.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Shell/CacheShell.php b/src/Shell/CacheShell.php index 335e0c97108..714003d036b 100644 --- a/src/Shell/CacheShell.php +++ b/src/Shell/CacheShell.php @@ -72,12 +72,20 @@ public function getOptionParser() public function clear($prefix = null) { try { + $engine = Cache::engine($prefix); Cache::clear(false, $prefix); + if ($engine instanceof \Cake\Cache\Engine\ApcEngine) { + $this->warn("ApcEngine detected: Cleared $prefix CLI cache successfully " . + "but $prefix web cache must be cleared separately."); + } elseif ($engine instanceof \Cake\Cache\Engine\WincacheEngine) { + $this->warn("WincacheEngine detected: Cleared $prefix CLI cache successfully " . + "but $prefix web cache must be cleared separately."); + } else { + $this->out("Cleared $prefix cache"); + } } catch (\InvalidArgumentException $e) { $this->abort($e->getMessage()); } - - $this->out("Cleared $prefix cache"); } /** @@ -87,14 +95,9 @@ public function clear($prefix = null) */ public function clearAll() { - if (version_compare(Configure::version(), '3.2.0', '>=')) { - Cache::clearAll(false); - $this->out("Cleared all caches"); - } else { - $prefixes = Cache::configured(); - foreach ($prefixes as $prefix) { - $this->clear($prefix); - } + $prefixes = Cache::configured(); + foreach ($prefixes as $prefix) { + $this->clear($prefix); } }