From 45c9d3d729a9c811282bdb9caa70450218200e8b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 29 Dec 2009 14:05:43 -0800 Subject: Add progress output and optional --sleep-time parameter to triminboxes.php --- classes/Notice_inbox.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'classes') diff --git a/classes/Notice_inbox.php b/classes/Notice_inbox.php index b39006542..d3ddad656 100644 --- a/classes/Notice_inbox.php +++ b/classes/Notice_inbox.php @@ -106,6 +106,13 @@ class Notice_inbox extends Memcached_DataObject return Memcached_DataObject::pkeyGet('Notice_inbox', $kv); } + /** + * Trim inbox for a given user to latest NOTICE_INBOX_LIMIT items + * (up to NOTICE_INBOX_GC_MAX will be deleted). + * + * @param int $user_id + * @return int count of notices dropped from the inbox, if any + */ static function gc($user_id) { $entry = new Notice_inbox(); @@ -133,6 +140,8 @@ class Notice_inbox extends Memcached_DataObject $notices = array(); } } + + return $total; } static function deleteMatching($user_id, $notices) -- cgit v1.2.3-54-g00ecf