From 1f4c69b1087e01d4c12c9ce0670ec4aeba560735 Mon Sep 17 00:00:00 2001 From: skeeter Date: Sun, 13 Jan 2002 17:20:33 +0000 Subject: [PATCH] This will now clear system/user level cache when adding/deleting apps. --- setup/inc/class.setup.inc.php | 24 ++++++++++++++++++++++++ setup/index.php | 14 +------------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index 720e7582ba..66af438d13 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -191,6 +191,28 @@ return $major; } + /*! + @function clear_session_cache + @abstract Clear system/user level cache so as to have it rebuilt with the next access + @param None + */ + function clear_session_cache() + { + + $tablenames = @$this->db->table_names(); + while(list($key,$val) = @each($tablenames)) + { + $tables[] = $val['table_name']; + } + if ($this->isinarray('phpgw_app_sessions',$tables)) + { + $this->db->lock(array('phpgw_app_sessions')); + @$this->db->query("DELETE FROM phpgw_app_sessions WHERE sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'",__LINE__,__FILE__); + @$this->db->query("DELETE FROM phpgw_app_sessions WHERE app = 'phpgwapi' and location = 'phpgw_info_cache'",__LINE__,__FILE__); + $this->db->unlock(); + } + } + /*! @function register_app @abstract Add an application to the phpgw_applications table @@ -268,6 +290,7 @@ . "'" . $tables . "'," . "'" . $setup_info[$appname]['version'] . "');" ); + $this->clear_session_cache(); } } @@ -435,6 +458,7 @@ //echo 'DELETING application: ' . $appname; $this->db->query("DELETE FROM $appstbl WHERE app_name='". $appname ."'"); + $this->clear_session_cache(); } /*! diff --git a/setup/index.php b/setup/index.php index efdeff334c..923148fb90 100644 --- a/setup/index.php +++ b/setup/index.php @@ -66,19 +66,7 @@ $phpgw_setup->show_footer(); /* Add cleaning of app_sessions per skeeter, but with a check for the table being there, just in case */ - $tablenames = @$phpgw_setup->db->table_names(); - while(list($key,$val) = @each($tablenames)) - { - $tables[] = $val['table_name']; - } - if ($phpgw_setup->isinarray('phpgw_app_sessions',$tables)) - { - $phpgw_setup->db->lock(array('phpgw_app_sessions')); - @$phpgw_setup->db->query("DELETE FROM phpgw_app_sessions WHERE sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'",__LINE__,__FILE__); - @$phpgw_setup->db->query("DELETE FROM phpgw_app_sessions WHERE app = 'phpgwapi' and location = 'phpgw_info_cache'",__LINE__,__FILE__); - $phpgw_setup->db->unlock(); - } - + $phpgw_setup->clear_session_cache(); exit; }