X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Factivitymover.php;h=ac828d94912f940a56fa1d9587a104d2bf02cf34;hb=13c331fa8152f11a811d2ff66210b3298bc21ada;hp=0493750d0877e5b8f8108011027e13b16eda9dc9;hpb=5fd6053220d9ff2c28735fcf5b8c99b83b09ecc0;p=quix0rs-gnu-social.git diff --git a/lib/activitymover.php b/lib/activitymover.php index 0493750d08..ac828d9491 100644 --- a/lib/activitymover.php +++ b/lib/activitymover.php @@ -56,7 +56,14 @@ class ActivityMover extends QueueHandler list ($act, $sink, $userURI, $remoteURI) = $data; $user = User::getKV('uri', $userURI); - $remote = Profile::fromURI($remoteURI); + try { + $remote = Profile::fromUri($remoteURI); + } catch (UnknownUriException $e) { + // Don't retry. It's hard to tell whether it's because of + // lookup failures or because the URI is permanently gone. + // If we knew it was temporary, we'd return false here. + return true; + } try { $this->moveActivity($act, $sink, $user, $remote); @@ -86,7 +93,7 @@ class ActivityMover extends QueueHandler } switch ($act->verb) { - case ActivityVerb::FAVORITE: +/* case ActivityVerb::FAVORITE: $this->log(LOG_INFO, "Moving favorite of {$act->objects[0]->id} by ". "{$act->actor->id} to {$remote->nickname}."); @@ -98,7 +105,7 @@ class ActivityMover extends QueueHandler 'notice_id' => $notice->id)); $fave->delete(); } - break; + break;*/ case ActivityVerb::POST: $this->log(LOG_INFO, "Moving notice {$act->objects[0]->id} by ". @@ -126,9 +133,11 @@ class ActivityMover extends QueueHandler "Moving subscription to {$act->objects[0]->id} by ". "{$act->actor->id} to {$remote->nickname}."); $sink->postActivity($act); - $other = Profile::fromURI($act->objects[0]->id); - if (!empty($other)) { + try { + $other = Profile::fromUri($act->objects[0]->id); Subscription::cancel($user->getProfile(), $other); + } catch (UnknownUriException $e) { + // Can't cancel subscription if we don't know who to alert } } else { $otherUser = User::getKV('uri', $act->actor->id); @@ -137,7 +146,7 @@ class ActivityMover extends QueueHandler "Changing sub to {$act->objects[0]->id}". "by {$act->actor->id} to {$remote->nickname}."); $otherProfile = $otherUser->getProfile(); - Subscription::start($otherProfile, $remote); + Subscription::ensureStart($otherProfile, $remote); Subscription::cancel($otherProfile, $user->getProfile()); } else { $this->log(LOG_NOTICE,