X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FSubMirror%2Fclasses%2FSubMirror.php;h=cdbbed6726e415c2ddcbd24d18cbef7ba7a36fe6;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=b39af918d5ddb2e073199c07a373ab190e77de75;hpb=59119482ca34540bd7f0a2a1aa994de1d5328ea2;p=quix0rs-gnu-social.git diff --git a/plugins/SubMirror/classes/SubMirror.php b/plugins/SubMirror/classes/SubMirror.php index b39af918d5..cdbbed6726 100644 --- a/plugins/SubMirror/classes/SubMirror.php +++ b/plugins/SubMirror/classes/SubMirror.php @@ -22,7 +22,7 @@ * @maintainer Brion Vibber */ -class SubMirror extends Memcached_DataObject +class SubMirror extends Managed_DataObject { public $__table = 'submirror'; @@ -34,11 +34,6 @@ class SubMirror extends Memcached_DataObject public $created; public $modified; - public /*static*/ function staticGet($k, $v=null) - { - return parent::staticGet(__CLASS__, $k, $v); - } - /** * return table definition for DB_DataObject * @@ -117,7 +112,7 @@ class SubMirror extends Memcached_DataObject function keyTypes() { - // @fixme keys + // @todo FIXME keys // need a sane key for reverse lookup too return array('subscriber' => 'K', 'subscribed' => 'K'); } @@ -153,11 +148,11 @@ class SubMirror extends Memcached_DataObject * @param Notice $notice * @return mixed Notice on successful mirroring, boolean if not */ - public function mirrorNotice($notice) + public function mirrorNotice(Notice $notice) { - $profile = Profile::staticGet('id', $this->subscriber); - if (!$profile) { - common_log(LOG_ERROR, "SubMirror plugin skipping auto-repeat of notice $notice->id for missing user $profile->id"); + $profile = Profile::getKV('id', $this->subscriber); + if (!($profile instanceof Profile)) { + common_log(LOG_ERR, "SubMirror plugin skipping auto-repeat of notice $notice->id for missing user $profile->id"); return false; } @@ -177,14 +172,14 @@ class SubMirror extends Memcached_DataObject * @param Notice $notice * @return mixed Notice on successful repeat, true if already repeated, false on failure */ - protected function repeatNotice($profile, $notice) + protected function repeatNotice(Profile $profile, Notice $notice) { - if($profile->hasRepeated($notice->id)) { + if($profile->hasRepeated($notice)) { common_log(LOG_INFO, "SubMirror plugin skipping auto-repeat of notice $notice->id for user $profile->id; already repeated."); return true; } else { common_log(LOG_INFO, "SubMirror plugin auto-repeating notice $notice->id for $profile->id"); - return $notice->repeat($profile->id, 'mirror'); + return $notice->repeat($profile, 'mirror'); } } @@ -193,13 +188,14 @@ class SubMirror extends Memcached_DataObject * Kind of dirty, but if pulling an external data feed into an account * that may be what you want. * - * @param Notice $notice - * @return mixed Notice on successful repeat, true if already repeated, false on failure + * @param Profile $profile + * @param Notice $notice + * @return mixed Notice on successful repeat, true if already repeated, false on failure */ - protected function copyNotice($profile, $notice) + protected function copyNotice(Profile $profile, Notice $notice) { $options = array('is_local' => Notice::LOCAL_PUBLIC, - 'url' => $notice->bestUrl(), // pass through the foreign link... + 'url' => $notice->getUrl(), // pass through the foreign link... 'rendered' => $notice->rendered); $saved = Notice::saveNew($profile->id, @@ -209,11 +205,6 @@ class SubMirror extends Memcached_DataObject return $saved; } - public /*static*/ function pkeyGet($v) - { - return parent::pkeyGet(__CLASS__, $v); - } - /** * Get the mirroring setting for a pair of profiles, if existing. *