X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile_list.php;h=27001978b6dd1ca9de26b02f67fdd9084aa97d8e;hb=2892f70d18065e1478c729f2de96218c9500e2df;hp=7de1d15730d054f84b04cf70763b3e6bb0417c7c;hpb=7a00be5cc73790ff46b8027713d2018a4a66986e;p=quix0rs-gnu-social.git diff --git a/classes/Profile_list.php b/classes/Profile_list.php index 7de1d15730..27001978b6 100644 --- a/classes/Profile_list.php +++ b/classes/Profile_list.php @@ -30,7 +30,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { */ require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class Profile_list extends Memcached_DataObject +class Profile_list extends Managed_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -49,11 +49,46 @@ class Profile_list extends Memcached_DataObject public $subscriber_count; // smallint /* Static get */ - function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Profile_list',$k,$v); } + function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile_list',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE + public static function schemaDef() + { + return array( + 'fields' => array( + 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), + 'tagger' => array('type' => 'int', 'not null' => true, 'description' => 'user making the tag'), + 'tag' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'people tag'), + 'description' => array('type' => 'text', 'description' => 'description of the people tag'), + 'private' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'is this tag private'), + + 'created' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was added'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was modified'), + + 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universal identifier'), + 'mainpage' => array('type' => 'varchar', 'length' => 255, 'description' => 'page to link to'), + 'tagged_count' => array('type' => 'int', 'default' => 0, 'description' => 'number of people tagged with this tag by this user'), + 'subscriber_count' => array('type' => 'int', 'default' => 0, 'description' => 'number of subscribers to this tag'), + ), + 'primary key' => array('tagger', 'tag'), + 'unique keys' => array( + 'profile_list_id_key' => array('id') + ), + 'foreign keys' => array( + 'profile_list_tagger_fkey' => array('profile', array('tagger' => 'id')), + ), + 'indexes' => array( + 'profile_list_modified_idx' => array('modified'), + 'profile_list_tag_idx' => array('tag'), + 'profile_list_tagger_tag_idx' => array('tagger', 'tag'), + 'profile_list_tagged_count_idx' => array('tagged_count'), + 'profile_list_subscriber_count_idx' => array('subscriber_count'), + ), + ); + } + /** * return a profile_list record, given its tag and tagger. * @@ -185,10 +220,12 @@ class Profile_list extends Memcached_DataObject function getSubscribers($offset=0, $limit=null, $since=0, $upto=0) { $subs = new Profile(); - $sub = new Profile_tag_subscription(); - $sub->profile_tag_id = $this->id; - $subs->joinAdd($sub); + $subs->joinAdd( + array('id', 'profile_tag_subscription:profile_id') + ); + $subs->whereAdd('profile_tag_subscription.profile_tag_id = ' . $this->id); + $subs->selectAdd('unix_timestamp(profile_tag_subscription.' . 'created) as "cursor"'); @@ -326,6 +363,8 @@ class Profile_list extends Memcached_DataObject Profile_tag::cleanup($this); Profile_tag_subscription::cleanup($this); + self::blow('profile:lists:%d', $this->tagger); + return parent::delete(); } @@ -910,4 +949,13 @@ class Profile_list extends Memcached_DataObject return new ArrayWrapper($wrapped); } } + + function insert() + { + $result = parent::insert(); + if ($result) { + self::blow('profile:lists:%d', $this->tagger); + } + return $result; + } }