Permalink
Browse files

Fix status page when cache dir is not writeable.

  • Loading branch information...
1 parent 4cef568 commit 1e29438a130780564e3de35d2f16ad5e5e69904e @lchenay lchenay committed Jul 9, 2012
Showing with 13 additions and 4 deletions.
  1. +12 −3 library/Centurion/Config/Directory.php
  2. +1 −1 public/status/Check.php
@@ -32,6 +32,8 @@
class Centurion_Config_Directory
{
protected static $_environment = null;
+
+ protected static $_noCache = false;
/**
* @static
@@ -78,9 +80,14 @@ public static function loadConfig($path, $environment, $recursivelyLoadModuleCon
$backendOptions = array('cache_dir' => APPLICATION_PATH . '/../data/cache/config/' );
$frontendOptions = array('master_files' => array_values($tabFile), 'automatic_serialization' => true, 'cache_id_prefix' => str_replace('-', '_', $environment));
- $cacheConfig = Zend_Cache::factory('File', 'File', $frontendOptions, $backendOptions);
+
+ try {
+ $cacheConfig = Zend_Cache::factory('File', 'File', $frontendOptions, $backendOptions);
+ } catch (Exception $e) {
+ self::$_noCache = true;
+ }
- if (!($config = $cacheConfig->load(md5(implode('|', $tabFile))))) {
+ if (self::$_noCache || !($config = $cacheConfig->load(md5(implode('|', $tabFile))))) {
$config = array();
foreach($tabFile as $file) {
@@ -96,7 +103,9 @@ public static function loadConfig($path, $environment, $recursivelyLoadModuleCon
}
}
- $cacheConfig->save($config);
+ if (!self::$_noCache) {
+ $cacheConfig->save($config);
+ }
}
if ($recursivelyLoadModuleConfig && isset($config['resources']) && isset($config['resources']['modules'])) {
@@ -468,10 +468,10 @@ public function check() {
$this->_checkRedirect();
+ $this->_checkPermission();
$this->_checkDbConnect();
$this->_checkDbTable();
- $this->_checkPermission();
$this->_checkDocumentRoot();
}

0 comments on commit 1e29438

Please sign in to comment.