mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
28a36282c5
commit
9fdd1c3630
2 changed files with 11 additions and 11 deletions
|
@ -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;
|
return false;
|
||||||
$settings = $_this->settings($engine);
|
|
||||||
$_this->__config[$name] = array_merge(array('engine' => $engine), $settings);
|
|
||||||
return compact('engine', 'settings');
|
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
1
cake/libs/cache/file.php
vendored
1
cake/libs/cache/file.php
vendored
|
@ -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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue