Merge branch '0.9.x' into socialbookmark
This commit is contained in:
commit
8814fb3822
14
EVENTS.txt
14
EVENTS.txt
@ -1026,3 +1026,17 @@ StartActivityObjectFromGroup: When converting a group to an activity:object
|
|||||||
EndActivityObjectFromGroup: After converting a group to an activity:object
|
EndActivityObjectFromGroup: After converting a group to an activity:object
|
||||||
- $group: The group being converted
|
- $group: The group being converted
|
||||||
- &$object: The finished object. Tweak as needed.
|
- &$object: The finished object. Tweak as needed.
|
||||||
|
|
||||||
|
StartImportActivity: when we start to import an activity
|
||||||
|
- $user: User to make the author import
|
||||||
|
- $author: Author of the feed; good for comparisons
|
||||||
|
- $activity: The current activity
|
||||||
|
- $trusted: How "trusted" the process is
|
||||||
|
- &$done: Return value; whether to continue
|
||||||
|
|
||||||
|
EndImportActivity: when we finish importing an activity
|
||||||
|
- $user: User to make the author import
|
||||||
|
- $author: Author of the feed; good for comparisons
|
||||||
|
- $activity: The current activity
|
||||||
|
- $trusted: How "trusted" the process is
|
||||||
|
|
||||||
|
@ -2033,7 +2033,7 @@ class Notice extends Memcached_DataObject
|
|||||||
*/
|
*/
|
||||||
public static function addWhereSinceId(DB_DataObject $obj, $id, $idField='id', $createdField='created')
|
public static function addWhereSinceId(DB_DataObject $obj, $id, $idField='id', $createdField='created')
|
||||||
{
|
{
|
||||||
$since = self::whereSinceId($id);
|
$since = self::whereSinceId($id, $idField, $createdField);
|
||||||
if ($since) {
|
if ($since) {
|
||||||
$obj->whereAdd($since);
|
$obj->whereAdd($since);
|
||||||
}
|
}
|
||||||
@ -2072,7 +2072,7 @@ class Notice extends Memcached_DataObject
|
|||||||
*/
|
*/
|
||||||
public static function addWhereMaxId(DB_DataObject $obj, $id, $idField='id', $createdField='created')
|
public static function addWhereMaxId(DB_DataObject $obj, $id, $idField='id', $createdField='created')
|
||||||
{
|
{
|
||||||
$max = self::whereMaxId($id);
|
$max = self::whereMaxId($id, $idField, $createdField);
|
||||||
if ($max) {
|
if ($max) {
|
||||||
$obj->whereAdd($max);
|
$obj->whereAdd($max);
|
||||||
}
|
}
|
||||||
|
@ -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…
Reference in New Issue
Block a user