* @maintainer Brion Vibber <brion@status.net>
*/
-class SubMirror extends Memcached_DataObject
+class SubMirror extends Managed_DataObject
{
public $__table = 'submirror';
public $created;
public $modified;
- public /*static*/ function staticGet($k, $v=null)
- {
- return parent::staticGet(__CLASS__, $k, $v);
- }
-
/**
* return table definition for DB_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;
}
* @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');
}
}
protected function copyNotice($profile, $notice)
{
$options = array('is_local' => Notice::LOCAL_PUBLIC,
- 'url' => $notice->bestUrl(), // pass through the foreign link...
- 'rendered' => $notice->rendered);
+ 'url' => $notice->getUrl(), // pass through the foreign link...
+ 'rendered' => $notice->getRendered());
$saved = Notice::saveNew($profile->id,
$notice->content,
return $saved;
}
- public /*static*/ function pkeyGet($v)
- {
- return parent::pkeyGet(__CLASS__, $v);
- }
-
/**
* Get the mirroring setting for a pair of profiles, if existing.
*