summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.php12
-rw-r--r--program/include/session.inc34
2 files changed, 6 insertions, 40 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index c3d599180..682686973 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2146,11 +2146,10 @@ class rcube_imap
{
$this->db->query(
"UPDATE ".get_table_name('cache')."
- SET created=". $this->db->fromunixtime(time()).", data=?, session_id=?
+ SET created=". $this->db->now().", data=?
WHERE user_id=?
AND cache_key=?",
$data,
- session_id(),
$_SESSION['user_id'],
$key);
}
@@ -2159,12 +2158,11 @@ class rcube_imap
{
$this->db->query(
"INSERT INTO ".get_table_name('cache')."
- (created, user_id, cache_key, data, session_id)
- VALUES (".$this->db->fromunixtime(time()).", ?, ?, ?, ?)",
+ (created, user_id, cache_key, data)
+ VALUES (".$this->db->now().", ?, ?, ?)",
$_SESSION['user_id'],
$key,
- $data,
- session_id());
+ $data);
}
}
@@ -2374,7 +2372,7 @@ class rcube_imap
$this->db->query(
"INSERT INTO ".get_table_name('messages')."
(user_id, del, cache_key, created, idx, uid, subject, ".$this->db->quoteIdentifier('from').", ".$this->db->quoteIdentifier('to').", cc, date, size, headers, structure)
- VALUES (?, 0, ?, ".$this->db->fromunixtime(time()).", ?, ?, ?, ?, ?, ?, ".$this->db->fromunixtime($headers->timestamp).", ?, ?, ?)",
+ VALUES (?, 0, ?, ".$this->db->now().", ?, ?, ?, ?, ?, ?, ".$this->db->fromunixtime($headers->timestamp).", ?, ?, ?)",
$_SESSION['user_id'],
$key,
$index,
diff --git a/program/include/session.inc b/program/include/session.inc
index 21d22ab28..3f01fcd53 100644
--- a/program/include/session.inc
+++ b/program/include/session.inc
@@ -111,12 +111,6 @@ function rcube_sess_destroy($key)
$DB->query("DELETE FROM " . get_table_name('session') . " WHERE sess_id=?", $key);
- // delete session entries in cache table
- // on databases wthout foreign keys
- if ($rcmail->config->get('enable_caching') && $DB->db_provider != 'pgsql') {
- $DB->query("DELETE FROM " . get_table_name('cache') . " WHERE session_id=?", $key);
- }
-
return true;
}
@@ -131,34 +125,8 @@ function rcube_sess_gc($maxlifetime)
return false;
}
- $now = $DB->fromunixtime(time() - $maxlifetime);
-
- // delete session entries in cache table
- if ($rcmail->config->get('enable_caching')) {
-
- // on databases wthout foreign keys...
- if($DB->db_provider != 'pgsql') {
-
- // get all expired sessions
- $sql_result = $DB->query(
- "SELECT sess_id FROM " . get_table_name('session') . "
- WHERE changed < " . $now);
-
- $exp_sessions = array();
- while ($sql_arr = $DB->fetch_assoc($sql_result)) {
- $exp_sessions[] = $sql_arr['sess_id'];
- }
-
- if (sizeof($exp_sessions)) {
- $exp_sessions = "'" . join("','", $exp_sessions) . "'";
- // delete session cache records
- $DB->query("DELETE FROM " . get_table_name('cache') . "
- WHERE session_id IN (" . $exp_sessions . ")");
- }
- }
- // also run message cache GC
+ if ($rcmail->config->get('enable_caching'))
rcmail_message_cache_gc();
- }
// just delete all expired sessions
$DB->query("DELETE FROM " . get_table_name('session') . "