summaryrefslogtreecommitdiff
path: root/program/include/session.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-12-03 16:54:12 +0000
committerthomascube <thomas@roundcube.net>2005-12-03 16:54:12 +0000
commit1cded85790206afe084e1baff371c543711b2b18 (patch)
treeb050fb89707e048df5f30f500faad792962a1e81 /program/include/session.inc
parent5bc8cb662fc3bcda9aa641b7a5e88c0b81dd63d6 (diff)
Re-design of caching (new database table added\!); some bugfixes; Postgres support
Diffstat (limited to 'program/include/session.inc')
-rw-r--r--program/include/session.inc16
1 files changed, 12 insertions, 4 deletions
diff --git a/program/include/session.inc b/program/include/session.inc
index 54ed798fc..f10a2b37e 100644
--- a/program/include/session.inc
+++ b/program/include/session.inc
@@ -45,7 +45,7 @@ function sess_read($key)
if ($sql_arr = $DB->fetch_assoc($sql_result))
{
- $SESS_CHANGED = $sql_arr['changed'];
+ $SESS_CHANGED = mktime(); //$sql_arr['changed'];
if (strlen($sql_arr['vars']))
return $sql_arr['vars'];
@@ -59,7 +59,7 @@ function sess_read($key)
function sess_write($key, $vars)
{
global $DB;
-
+
$sql_result = $DB->query("SELECT 1
FROM ".get_table_name('session')."
WHERE sess_id=?",
@@ -83,6 +83,8 @@ function sess_write($key, $vars)
$key,
$vars,
$_SERVER['REMOTE_ADDR']);
+
+
}
return TRUE;
@@ -102,7 +104,9 @@ function sess_destroy($key)
$DB->query("DELETE FROM ".get_table_name('session')."
WHERE sess_id=?",
$key);
-
+
+ rcmail_clear_session_temp($key);
+
return TRUE;
}
@@ -115,7 +119,7 @@ function sess_gc($maxlifetime)
// get all expired sessions
$sql_result = $DB->query("SELECT sess_id
FROM ".get_table_name('session')."
- WHERE ".$DB->unixtimestamp('now()')."-".$DB->unixtimestamp('created')." > ?",
+ WHERE ".$DB->unixtimestamp('now()')."-".$DB->unixtimestamp('changed')." > ?",
$maxlifetime);
$a_exp_sessions = array();
@@ -134,6 +138,10 @@ function sess_gc($maxlifetime)
WHERE sess_id IN ('".join("','", $a_exp_sessions)."')");
}
+ // remove session specific temp dirs
+ foreach ($a_exp_sessions as $key)
+ rcmail_clear_session_temp($key);
+
return TRUE;
}