Add progress output and optional --sleep-time parameter to triminboxes.php

This commit is contained in:
Brion Vibber
2009-12-29 14:05:43 -08:00
parent 360fdb219d
commit 45c9d3d729
2 changed files with 31 additions and 2 deletions

View File

@@ -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)