+ return $inbox;
+ }
+
+ static function insertNotice($user_id, $notice_id)
+ {
+ $inbox = DB_DataObject::staticGet('inbox', 'user_id', $user_id);
+
+ if (empty($inbox)) {
+ $inbox = Inbox::initialize($user_id);
+ }
+
+ if (empty($inbox)) {
+ return false;
+ }
+
+ $result = $inbox->query(sprintf('UPDATE inbox '.
+ 'set notice_ids = concat(cast(0x%08x as binary(4)), '.
+ 'substr(notice_ids, 1, 4092)) '.
+ 'WHERE user_id = %d',
+ $notice_id, $user_id));
+
+ if ($result) {
+ self::blow('inbox:user_id:%d', $user_id);
+ }
+
+ return $result;
+ }
+
+ static function bulkInsert($notice_id, $user_ids)
+ {
+ foreach ($user_ids as $user_id)
+ {
+ Inbox::insertNotice($user_id, $notice_id);