From 26a49141a192f77ecd696fc54b18a7023383cdbe Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 24 Nov 2010 00:37:45 -0700 Subject: [PATCH] Better error handling if cache entries can not be deleted --- framework/Core/lib/Horde/Core/Factory/ThemesCache.php | 9 ++++++--- horde/bin/themes | 10 ++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/framework/Core/lib/Horde/Core/Factory/ThemesCache.php b/framework/Core/lib/Horde/Core/Factory/ThemesCache.php index e9a89408e..b4188f1e8 100644 --- a/framework/Core/lib/Horde/Core/Factory/ThemesCache.php +++ b/framework/Core/lib/Horde/Core/Factory/ThemesCache.php @@ -101,7 +101,8 @@ class Horde_Core_Factory_ThemesCache * @param string $app The application name. * @param string $theme The theme name. * - * @return boolean True if cache entry existed. + * @return boolean True if cache entry existed and was deleted. + * @throws Horde_Exception */ public function expireCache($app, $theme) { @@ -110,9 +111,11 @@ class Horde_Core_Factory_ThemesCache $cache = $this->_injector->getInstance('Horde_Cache'); if ($cache->exists($sig, $GLOBALS['conf']['cachethemesparams']['lifetime'])) { - $cache->expire($sig); - unset($this->_instances[$sig]); + if (!$cache->expire($sig)) { + throw new Horde_Exception('Could not delete cache entry.'); + } + unset($this->_instances[$sig]); return true; } diff --git a/horde/bin/themes b/horde/bin/themes index ad86c3cb9..9990fddab 100755 --- a/horde/bin/themes +++ b/horde/bin/themes @@ -36,10 +36,16 @@ foreach ($options[0] as $val) { $tcache = $injector->getInstance('Horde_Core_Factory_ThemesCache'); $tlist = array_keys(Horde_Themes::themeList()); + $cli->writeln(); + foreach ($registry->listAllApps() as $app) { foreach ($tlist as $theme) { - if ($tcache->expireCache($app, $theme)) { - $cli->message('Cache entry expired [APP: ' . $app . '; THEME: ' . $theme . ']'); + try { + if ($tcache->expireCache($app, $theme)) { + $cli->message('Cache entry expired [APP: ' . $app . '; THEME: ' . $theme . ']'); + } + } catch (Horde_Exception $e) { + $cli->message('Could not expire cache entry [APP: ' . $app . '; THEME: ' . $theme . ']', 'cli.warning'); } } } -- 2.11.0