summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2009-12-29 14:05:43 -0800
committerBrion Vibber <brion@pobox.com>2009-12-29 14:16:22 -0800
commite3850e5273904a222580ff8daa3e778518721161 (patch)
treebb61bbc98e58d2e4f9b3a2ed22c6d90a26eb95ab /classes
parent2cfa90c75203d95c859e8da2c4d9dbd6afe43500 (diff)
Add progress output and optional --sleep-time parameter to triminboxes.php
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice_inbox.php9
1 files changed, 9 insertions, 0 deletions
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)