add events for restoring activities
This commit is contained in:
parent
75e671774d
commit
1996545947
@ -63,31 +63,40 @@ class ActivityImporter extends QueueHandler
|
|||||||
|
|
||||||
$this->trusted = $trusted;
|
$this->trusted = $trusted;
|
||||||
|
|
||||||
try {
|
$done = null;
|
||||||
switch ($activity->verb) {
|
|
||||||
case ActivityVerb::FOLLOW:
|
if (Event::handle('StartImportActivity',
|
||||||
$this->subscribeProfile($user, $author, $activity);
|
array($user, $author, $activity, $trusted, &$done))) {
|
||||||
break;
|
|
||||||
case ActivityVerb::JOIN:
|
try {
|
||||||
$this->joinGroup($user, $activity);
|
switch ($activity->verb) {
|
||||||
break;
|
case ActivityVerb::FOLLOW:
|
||||||
case ActivityVerb::POST:
|
$this->subscribeProfile($user, $author, $activity);
|
||||||
$this->postNote($user, $author, $activity);
|
break;
|
||||||
break;
|
case ActivityVerb::JOIN:
|
||||||
default:
|
$this->joinGroup($user, $activity);
|
||||||
throw new Exception("Unknown verb: {$activity->verb}");
|
break;
|
||||||
|
case ActivityVerb::POST:
|
||||||
|
$this->postNote($user, $author, $activity);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ClientException("Unknown verb: {$activity->verb}");
|
||||||
|
}
|
||||||
|
Event::handle('EndImportActivity',
|
||||||
|
array($user, $author, $activity, $trusted));
|
||||||
|
$done = true;
|
||||||
|
} catch (ClientException $ce) {
|
||||||
|
common_log(LOG_WARNING, $ce->getMessage());
|
||||||
|
$done = true;
|
||||||
|
} catch (ServerException $se) {
|
||||||
|
common_log(LOG_ERR, $se->getMessage());
|
||||||
|
$done = false;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
common_log(LOG_ERR, $e->getMessage());
|
||||||
|
$done = false;
|
||||||
}
|
}
|
||||||
} catch (ClientException $ce) {
|
|
||||||
common_log(LOG_WARNING, $ce->getMessage());
|
|
||||||
return true;
|
|
||||||
} catch (ServerException $se) {
|
|
||||||
common_log(LOG_ERR, $se->getMessage());
|
|
||||||
return false;
|
|
||||||
} catch (Exception $e) {
|
|
||||||
common_log(LOG_ERR, $e->getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return $done;
|
||||||
}
|
}
|
||||||
|
|
||||||
function subscribeProfile($user, $author, $activity)
|
function subscribeProfile($user, $author, $activity)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user