3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2008-2010, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('STATUSNET')) {
24 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
26 // We keep 5 pages of inbox notices in memcache, +1 for pagination check
28 define('INBOX_CACHE_WINDOW', 101);
29 define('NOTICE_INBOX_GC_BOXCAR', 128);
30 define('NOTICE_INBOX_GC_MAX', 12800);
31 define('NOTICE_INBOX_LIMIT', 1000);
32 define('NOTICE_INBOX_SOFT_LIMIT', 1000);
34 class Notice_inbox extends Managed_DataObject
37 /* the code below is auto generated do not remove the above tag */
39 public $__table = 'notice_inbox'; // table name
40 public $user_id; // int(4) primary_key not_null
41 public $notice_id; // int(4) primary_key not_null
42 public $created; // datetime() not_null
43 public $source; // tinyint(1) default_1
46 function staticGet($k,$v=null)
47 { return Memcached_DataObject::staticGet('Notice_inbox',$k,$v); }
49 /* the code above is auto generated do not remove the tag below */
52 public static function schemaDef()
55 'description' => 'Obsolete; old entries here are converted to packed entries in the inbox table since 0.9',
57 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user receiving the message'),
58 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice received'),
59 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice was created'),
60 'source' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'reason it is in the inbox, 1=subscription'),
62 'primary key' => array('user_id', 'notice_id'),
63 'foreign keys' => array(
64 'notice_inbox_user_id_fkey' => array('user', array('user_id' => 'id')),
65 'notice_inbox_notice_id_fkey' => array('notice', array('notice_id' => 'id')),
68 'notice_inbox_notice_id_idx' => array('notice_id'),
73 function stream($user_id, $offset, $limit, $since_id, $max_id, $own=false)
75 throw new Exception('Notice_inbox no longer used; use Inbox');
78 function _streamDirect($user_id, $own, $offset, $limit, $since_id, $max_id)
80 throw new Exception('Notice_inbox no longer used; use Inbox');
83 function &pkeyGet($kv)
85 return Memcached_DataObject::pkeyGet('Notice_inbox', $kv);
88 static function gc($user_id)
90 throw new Exception('Notice_inbox no longer used; use Inbox');
93 static function deleteMatching($user_id, $notices)
95 throw new Exception('Notice_inbox no longer used; use Inbox');
98 static function bulkInsert($notice_id, $created, $ni)
100 throw new Exception('Notice_inbox no longer used; use Inbox');