From 38dc510b2dba02dba5a60fbc00947aac4fd24aab Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 29 Feb 2012 06:53:52 -0500
Subject: [PATCH] - Fix warning when properties array is empty

---
 program/include/rcube_imap_cache.php |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/program/include/rcube_imap_cache.php b/program/include/rcube_imap_cache.php
index 96c49f7..655979d 100644
--- a/program/include/rcube_imap_cache.php
+++ b/program/include/rcube_imap_cache.php
@@ -599,6 +599,27 @@
 
 
     /**
+     * Delete cache entries older than TTL
+     *
+     * @param string $ttl  Lifetime of message cache entries
+     */
+    function expunge($ttl)
+    {
+        // get expiration timestamp
+        $ts = get_offset_time($ttl, -1);
+
+        $this->db->query("DELETE FROM ".get_table_name('cache_messages')
+              ." WHERE changed < " . $this->db->fromunixtime($ts));
+
+        $this->db->query("DELETE FROM ".get_table_name('cache_index')
+              ." WHERE changed < " . $this->db->fromunixtime($ts));
+
+        $this->db->query("DELETE FROM ".get_table_name('cache_thread')
+              ." WHERE changed < " . $this->db->fromunixtime($ts));
+    }
+
+
+    /**
      * Fetches index data from database
      */
     private function get_index_row($mailbox)

--
Gitblit v1.9.1