From 9fdd1c363013b9d4c698cfe3dc5a3c793bc562fd Mon Sep 17 00:00:00 2001 From: gwoo Date: Fri, 19 Oct 2007 05:11:43 +0000 Subject: [PATCH] updating cache git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5793 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/cache.php | 21 ++++++++++----------- cake/libs/cache/file.php | 1 + 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cake/libs/cache.php b/cake/libs/cache.php index 06a87d5f6..a5f7742c8 100644 --- a/cake/libs/cache.php +++ b/cake/libs/cache.php @@ -45,7 +45,6 @@ class Cache extends Object { * @access protected */ var $_Engine = null; - /** * Cache configuration stack * @@ -98,7 +97,7 @@ class Cache extends Object { * @return array(engine, settings) on success, false on failure * @access public */ - function config($name = 'default', $settings = array('engine' => 'File')) { + function config($name = 'default', $settings = array()) { $_this =& Cache::getInstance(); if(is_array($name)) { extract($name); @@ -106,26 +105,27 @@ class Cache extends Object { if(isset($_this->__config[$name])) { $settings = array_merge($_this->__config[$name], $settings); - } elseif (!empty($name) && !empty($settings)) { - $settings = $_this->__config[$name] = array_merge(array('engine' => 'File'), $settings); + } elseif (is_string($name) && !empty($settings)) { + $_this->__config[$name] = $settings; } else { $name = 'default'; $settings = $_this->__config['default']; } + $engine = 'File'; if(!empty($settings['engine'])) { $engine = $settings['engine']; } if($name !== $_this->__currentConfig) { - if($_this->engine($engine, $settings)) { - $_this->__currentConfig = $name; - $settings = $_this->settings($engine); - $_this->__config[$name] = array_merge(array('engine' => $engine), $settings); - return compact('engine', 'settings'); + if($_this->engine($engine, $settings) === false) { + return false; } - return false; + $_this->__currentConfig = $name; + $_this->__config[$name] = array_merge(array('engine' => $engine), $_this->settings($engine)); } + + $settings = $_this->__config[$name]; return compact('engine', 'settings'); } /** @@ -156,7 +156,6 @@ class Cache extends Object { } return true; } - $_this->_Engine[$name] = null; return false; } diff --git a/cake/libs/cache/file.php b/cake/libs/cache/file.php index abbb148e0..5441f106d 100644 --- a/cake/libs/cache/file.php +++ b/cake/libs/cache/file.php @@ -78,6 +78,7 @@ class FileEngine extends CacheEngine { } $this->settings['path'] = $this->__File->Folder->cd($this->settings['path']); if (!is_writable($this->settings['path'])) { + trigger_error(__(sprintf('%s is not writable', $this->settings['path']), true), E_USER_WARNING); return false; } return true;