updating cache

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5793 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-10-19 05:11:43 +00:00
parent 28a36282c5
commit 9fdd1c3630
2 changed files with 11 additions and 11 deletions

View file

@ -45,7 +45,6 @@ class Cache extends Object {
* @access protected * @access protected
*/ */
var $_Engine = null; var $_Engine = null;
/** /**
* Cache configuration stack * Cache configuration stack
* *
@ -98,7 +97,7 @@ class Cache extends Object {
* @return array(engine, settings) on success, false on failure * @return array(engine, settings) on success, false on failure
* @access public * @access public
*/ */
function config($name = 'default', $settings = array('engine' => 'File')) { function config($name = 'default', $settings = array()) {
$_this =& Cache::getInstance(); $_this =& Cache::getInstance();
if(is_array($name)) { if(is_array($name)) {
extract($name); extract($name);
@ -106,26 +105,27 @@ class Cache extends Object {
if(isset($_this->__config[$name])) { if(isset($_this->__config[$name])) {
$settings = array_merge($_this->__config[$name], $settings); $settings = array_merge($_this->__config[$name], $settings);
} elseif (!empty($name) && !empty($settings)) { } elseif (is_string($name) && !empty($settings)) {
$settings = $_this->__config[$name] = array_merge(array('engine' => 'File'), $settings); $_this->__config[$name] = $settings;
} else { } else {
$name = 'default'; $name = 'default';
$settings = $_this->__config['default']; $settings = $_this->__config['default'];
} }
$engine = 'File';
if(!empty($settings['engine'])) { if(!empty($settings['engine'])) {
$engine = $settings['engine']; $engine = $settings['engine'];
} }
if($name !== $_this->__currentConfig) { if($name !== $_this->__currentConfig) {
if($_this->engine($engine, $settings)) { if($_this->engine($engine, $settings) === false) {
$_this->__currentConfig = $name;
$settings = $_this->settings($engine);
$_this->__config[$name] = array_merge(array('engine' => $engine), $settings);
return compact('engine', 'settings');
}
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'); return compact('engine', 'settings');
} }
/** /**
@ -156,7 +156,6 @@ class Cache extends Object {
} }
return true; return true;
} }
$_this->_Engine[$name] = null; $_this->_Engine[$name] = null;
return false; return false;
} }

View file

@ -78,6 +78,7 @@ class FileEngine extends CacheEngine {
} }
$this->settings['path'] = $this->__File->Folder->cd($this->settings['path']); $this->settings['path'] = $this->__File->Folder->cd($this->settings['path']);
if (!is_writable($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 false;
} }
return true; return true;