From 1a659d789f8a30b0e8ee21f1c34abdfc1e1cd737 Mon Sep 17 00:00:00 2001 From: alecpl Date: Thu, 8 May 2008 06:59:48 +0000 Subject: - Don't attempt to delete cache entries if enable_caching is FALSE (#1485051) --- program/include/session.inc | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'program') diff --git a/program/include/session.inc b/program/include/session.inc index 9becacf00..a789fd2d7 100644 --- a/program/include/session.inc +++ b/program/include/session.inc @@ -26,7 +26,6 @@ function sess_open($save_path, $session_name) } - function sess_close() { return TRUE; @@ -90,8 +89,6 @@ function sess_write($key, $vars) $key, $vars, $_SERVER['REMOTE_ADDR']); - - } return TRUE; @@ -101,15 +98,18 @@ function sess_write($key, $vars) // handler for session_destroy() function sess_destroy($key) { - global $DB; + global $DB, $CONFIG; if ($DB->is_error()) return FALSE; - - // delete session entries in cache table - $DB->query("DELETE FROM ".get_table_name('cache')." - WHERE session_id=?", + + if ($CONFIG['enable_caching']) + { + // delete session entries in cache table + $DB->query("DELETE FROM ".get_table_name('cache')." + WHERE session_id=?", $key); + } $DB->query("DELETE FROM ".get_table_name('session')." WHERE sess_id=?", @@ -122,7 +122,7 @@ function sess_destroy($key) // garbage collecting function function sess_gc($maxlifetime) { - global $DB; + global $DB, $CONFIG; if ($DB->is_error()) return FALSE; @@ -137,20 +137,23 @@ function sess_gc($maxlifetime) while ($sql_arr = $DB->fetch_assoc($sql_result)) $a_exp_sessions[] = $sql_arr['sess_id']; - if (sizeof($a_exp_sessions)) { - // delete session cache records - $DB->query("DELETE FROM ".get_table_name('cache')." - WHERE session_id IN ('".join("','", $a_exp_sessions)."')"); - + if ($CONFIG['enable_caching']) + { + // delete session cache records + $DB->query("DELETE FROM ".get_table_name('cache')." + WHERE session_id IN ('".join("','", $a_exp_sessions)."')"); + } + // delete session records $DB->query("DELETE FROM ".get_table_name('session')." WHERE sess_id IN ('".join("','", $a_exp_sessions)."')"); } // also run message cache GC - rcmail_message_cache_gc(); + if ($CONFIG['enable_caching']) + rcmail_message_cache_gc(); rcmail_temp_gc(); return TRUE; -- cgit v1.2.3