summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2006-02-05 15:38:51 +0000
committerthomascube <thomas@roundcube.net>2006-02-05 15:38:51 +0000
commitcc95700b58f31f04470db8271a09d6e52ba9a63d (patch)
tree88db35bcbdeaab851eee0d0570ab7cc8c077be23 /program/include/main.inc
parentfd80c1eed83f1792176ad0cf13cdc06f71e49da6 (diff)
Added message cache garbage collector
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc20
1 files changed, 19 insertions, 1 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 3c078364e..ac612cd06 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -697,6 +697,22 @@ function rcmail_clear_session_temp($sess_id)
}
+// remove all expired message cache records
+function rcmail_message_cache_gc()
+ {
+ global $DB, $CONFIG;
+
+ // no cache lifetime configured
+ if (empty($CONFIG['message_cache_lifetime']))
+ return;
+
+ // get target timestamp
+ $ts = get_offset_time($CONFIG['message_cache_lifetime'], -1);
+
+ $DB->query("DELETE FROM ".get_table_name('messages')."
+ WHERE created < ".$DB->fromunixtime($ts));
+ }
+
// convert a string from one charset to another
// this function is not complete and not tested well
@@ -709,7 +725,7 @@ function rcube_charset_convert($str, $from, $to=NULL)
return $str;
// convert charset using iconv module
- if (0 && function_exists('iconv') && $from!='UTF-7' && $to!='UTF-7') {
+ if (function_exists('iconv') && $from!='UTF-7' && $to!='UTF-7') {
return iconv($from, $to, $str);
}
@@ -1506,6 +1522,8 @@ function rcmail_charset_selector($attrib)
}
+/****** debugging function ********/
+
function rcube_timer()
{
list($usec, $sec) = explode(" ", microtime());