summaryrefslogtreecommitdiff
path: root/program/include/session.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-05-08 06:59:48 +0000
committeralecpl <alec@alec.pl>2008-05-08 06:59:48 +0000
commit1a659d789f8a30b0e8ee21f1c34abdfc1e1cd737 (patch)
treec9b14cbe8562a720336d5af756323716811c39c0 /program/include/session.inc
parent4f9c8337420327802baf73cde7d96b991b1fd1a9 (diff)
- Don't attempt to delete cache entries if enable_caching is FALSE (#1485051)
Diffstat (limited to 'program/include/session.inc')
-rw-r--r--program/include/session.inc33
1 files changed, 18 insertions, 15 deletions
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;