From 3b68b8bff85645752990c16224390e290499bb7c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 16 Apr 2014 17:57:44 +0000 Subject: [PATCH] need to consider caching when applying setup operations --- phpgwapi/inc/class.egw_cache.inc.php | 9 +++++++++ setup/inc/class.setup_cmd.inc.php | 6 ++++++ setup/inc/class.setup_cmd_config.inc.php | 3 +++ 3 files changed, 18 insertions(+) diff --git a/phpgwapi/inc/class.egw_cache.inc.php b/phpgwapi/inc/class.egw_cache.inc.php index c85f4fcb3d..53e372455e 100644 --- a/phpgwapi/inc/class.egw_cache.inc.php +++ b/phpgwapi/inc/class.egw_cache.inc.php @@ -568,6 +568,15 @@ class egw_cache return $ret; } + /** + * Unset instance key, so it get read again and re-read install_id from database + */ + static public function unset_instance_key() + { + self::$instance_key = null; + $GLOBALS['egw_info']['server']['install_id'] = egw_cache::get_system_config('install_id', false); + } + /** * Key used for instance specific data * diff --git a/setup/inc/class.setup_cmd.inc.php b/setup/inc/class.setup_cmd.inc.php index eb7142274c..f89a38eb3a 100644 --- a/setup/inc/class.setup_cmd.inc.php +++ b/setup/inc/class.setup_cmd.inc.php @@ -138,6 +138,9 @@ abstract class setup_cmd extends admin_cmd { $GLOBALS['egw']->db->disconnect(); $GLOBALS['egw']->db = new egw_db($GLOBALS['egw_domain'][$domain]); + + // change caching to managed instance + egw_cache::unset_instance_key(); } } @@ -152,6 +155,9 @@ abstract class setup_cmd extends admin_cmd $GLOBALS['egw']->db->disconnect(); $GLOBALS['egw']->db = new egw_db($GLOBALS['egw_info']['server']); + // change caching back to own instance + egw_cache::unset_instance_key(); + if (!is_null(self::$egw_accounts_backup)) { $GLOBALS['egw']->accounts = self::$egw_accounts_backup; diff --git a/setup/inc/class.setup_cmd_config.inc.php b/setup/inc/class.setup_cmd_config.inc.php index 27bd51ef80..26383250d2 100644 --- a/setup/inc/class.setup_cmd_config.inc.php +++ b/setup/inc/class.setup_cmd_config.inc.php @@ -93,6 +93,9 @@ class setup_cmd_config extends setup_cmd { if ($save_mail_account) $this->_save_mail_account($values); + // flush instance cache, so above config get read from database not cache + egw_cache::flush(); + $this->restore_db(); return lang('Configuration changed.');