updating Cache default config and fixes notices if cache is not configured

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5785 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-10-18 07:08:45 +00:00
parent 81079f730c
commit bd7187b359

View file

@ -98,16 +98,15 @@ class Cache extends Object {
* @return array(engine, settings) on success, false on failure
* @access public
*/
function config($name = 'default', $settings = array()) {
function config($name = 'default', $settings = array('engine' => 'File')) {
$_this =& Cache::getInstance();
if(is_array($name)) {
$config = array_merge(array('name' => 'default', 'settings'=> $settings), $name);
extract($config);
extract($name);
}
if(isset($_this->__config[$name])) {
$settings = array_merge($_this->__config[$name], $settings);
} elseif (!empty($settings)) {
} elseif (!empty($name) && !empty($settings)) {
$settings = $_this->__config[$name] = array_merge(array('engine' => 'File'), $settings);
} else {
$name = 'default';
@ -289,7 +288,7 @@ class Cache extends Object {
return false;
}
$_this =& Cache::getInstance();
if(!$engine) {
if(!$engine && $_this->__currentConfig !== null) {
$engine = $_this->__config[$_this->__currentConfig]['engine'];
}
return isset($_this->_Engine[$engine]);
@ -302,12 +301,12 @@ class Cache extends Object {
* @return array list of settings for this engine
* @access public
*/
function settings($engine = null) {
function settings($engine = 'File') {
$_this =& Cache::getInstance();
if(!$engine && isset($_this->__config[$_this->__currentConfig]['engine'])) {
$engine = $_this->__config[$_this->__currentConfig]['engine'];
}
if (!is_null($_this->_Engine[$engine])) {
if (isset($_this->_Engine[$engine]) && !is_null($_this->_Engine[$engine])) {
return $_this->_Engine[$engine]->settings();
}
return array();