3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2008, 2009, 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') && !defined('LACONICA')) {
25 * Table Definition for rsscloud_subscription
28 require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
30 class RSSCloudSubscription extends Memcached_DataObject {
32 var $__table='rsscloud_subscription'; // table name
33 var $subscribed; // int primary key user id
34 var $url; // string primary key
36 var $created; // datestamp()
37 var $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
39 function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Grp',$k,$v); }
44 $db = $this->getDatabaseConnection();
45 $dbtype = $db->phptype;
47 $cols = array('subscribed' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
48 'url' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
49 'failures' => DB_DATAOBJECT_INT,
50 'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
51 'modified' => ($dbtype == 'mysql' || $dbtype == 'mysqli') ?
52 DB_DATAOBJECT_MYSQLTIMESTAMP + DB_DATAOBJECT_NOTNULL :
53 DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME
61 return array('subscribed' => 'N', 'url' => 'N');
64 static function getSubscription($subscribed, $url)
66 $sub = new RSSCloudSubscription();
67 $sub->whereAdd("subscribed = $subscribed");
68 $sub->whereAdd("url = '$url'");