From 0800101bb40ec4f9afeb3166e742108204ca36f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 15 May 2012 23:54:39 +0200 Subject: [PATCH] Adding several health checks - Disabling of cache (warning) - Using DebugMailSender (warning) - Fallback on DiskCache when using memcached or APC (error) - Fallback on GD when using Imagick (error) --- .../files/lib/acp/page/IndexPage.class.php | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/page/IndexPage.class.php b/wcfsetup/install/files/lib/acp/page/IndexPage.class.php index 9747d86362..e99495e390 100755 --- a/wcfsetup/install/files/lib/acp/page/IndexPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/IndexPage.class.php @@ -1,12 +1,15 @@ healthDetails['warning'][] = WCF::getLanguage()->getDynamicVariable('wcf.acp.index.health.notWritable', array('file' => $file)); + if (!is_writable($file)) { + $this->healthDetails['warning'][] = WCF::getLanguage()->getDynamicVariable('wcf.acp.index.health.notWritable', array( + 'file' => $file + )); + } } for($i = 0; $i < 7; $i++) { if (file_exists(WCF_DIR.'log/'.date('Y-m-d', TIME_NOW - 86400 * $i).'.txt')) { - $this->healthDetails['error'][] = WCF::getLanguage()->getDynamicVariable('wcf.acp.index.health.exception', array('date' => TIME_NOW - 86400 * $i)); + $this->healthDetails['error'][] = WCF::getLanguage()->getDynamicVariable('wcf.acp.index.health.exception', array( + 'date' => TIME_NOW - 86400 * $i + )); break; } } + if (CacheHandler::getInstance()->getCacheSource() instanceof NoCacheSource) { + $this->healthDetails['warning'][] = WCF::getLanguage()->get('wcf.acp.index.health.noCacheSource'); + } + else if (!ClassUtil::isInstanceOf(CacheHandler::getInstance()->getCacheSource(), 'wcf\system\cache\source'.ucfirst(CACHE_SOURCE_TYPE).'CacheSource')) { + $this->healthDetails['error'][] = WCF::getLanguage()->getDynamicVariable('wcf.acp.index.health.cacheFallback', array( + 'shouldBe' => WCF::getLanguage()->get('wcf.acp.option.cache_source_type.'.CACHE_SOURCE_TYPE) + )); + } + + if (MAIL_SEND_METHOD === 'debug') { + $this->healthDetails['warning'][] = WCF::getLanguage()->get('wcf.acp.index.health.debugMailSender'); + } + + if (IMAGE_ADAPTER_TYPE === 'imagick' && !ImagickImageAdapter::isSupported()) { + $this->healthDetails['error'][] = WCF::getLanguage()->get('wcf.acp.index.health.imageAdapterFallback'); + } + EventHandler::getInstance()->fireAction($this, 'calculateHealth'); } catch (\Exception $e) { -- 2.20.1