From 2ed73047df44424cb60b9bca1ae6152819f32023 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 13 Sep 2011 09:25:25 +0000 Subject: [PATCH] fixed serveral issues around cached config: - changing config in setup did not update or unset the cache --> instance was NOT using it - new installs failed, because cache was not configured - cache command to not configured cache gave fatal error, now they throw a (catchable) exception --- phpgwapi/inc/class.config.inc.php | 3 ++- phpgwapi/inc/class.egw_cache.inc.php | 11 +++++++++-- setup/config.php | 2 ++ setup/inc/class.setup_process.inc.php | 7 ++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.config.inc.php b/phpgwapi/inc/class.config.inc.php index 8d6020cdcb..5dafda44a9 100755 --- a/phpgwapi/inc/class.config.inc.php +++ b/phpgwapi/inc/class.config.inc.php @@ -93,7 +93,8 @@ class config { if (!isset($this->config_data[$name])) // has been deleted { - self::$db->delete(config::TABLE,array('config_app'=>$this->appname,'config_name'=>$name),__LINE__,__FILE__); + $this->save_value($name,null,null,false); + //self::$db->delete(config::TABLE,array('config_app'=>$this->appname,'config_name'=>$name),__LINE__,__FILE__); } } self::$db->unlock(); diff --git a/phpgwapi/inc/class.egw_cache.inc.php b/phpgwapi/inc/class.egw_cache.inc.php index c669f639da..9198a745b5 100644 --- a/phpgwapi/inc/class.egw_cache.inc.php +++ b/phpgwapi/inc/class.egw_cache.inc.php @@ -460,10 +460,17 @@ class egw_cache { $db = $GLOBALS['egw']->db ? $GLOBALS['egw']->db : $GLOBALS['egw_setup']->db; - $GLOBALS['egw_info']['server'][$name] = $db->select(config::TABLE,'config_value',array( + if (($rs = $db->select(config::TABLE,'config_value',array( 'config_app' => 'phpgwapi', 'config_name' => $name, - ),__LINE__,__FILE__)->fetchColumn(); + ),__LINE__,__FILE__))) + { + $GLOBALS['egw_info']['server'][$name] = $rs->fetchColumn(); + } + else + { + error_log(__METHOD__."('name', $throw) cound NOT query value!"); + } } if (!$GLOBALS['egw_info']['server'][$name] && $throw) { diff --git a/setup/config.php b/setup/config.php index 19417b73b8..ea28469659 100644 --- a/setup/config.php +++ b/setup/config.php @@ -104,6 +104,8 @@ if(@get_var('submit',Array('POST')) && @$newsettings) if(!$GLOBALS['error']) { $GLOBALS['egw_setup']->db->transaction_commit(); + // unset cached config, as this is the primary source for configuration now + egw_cache::unsetInstance('config', 'configs'); Header('Location: index.php'); exit; diff --git a/setup/inc/class.setup_process.inc.php b/setup/inc/class.setup_process.inc.php index 8cf24fdbf7..92f443dee9 100755 --- a/setup/inc/class.setup_process.inc.php +++ b/setup/inc/class.setup_process.inc.php @@ -62,7 +62,12 @@ class setup_process $GLOBALS['egw_setup']->oProc = new schema_proc(); // delete image-map, in case new apps get installed, or existing ones updated - common::delete_image_map(); + try { + common::delete_image_map(); + } + catch(Exception $e) { + // ignore exception, as during a new install, there's no cache configured and therefore no need to unset + } } /**