Code cleanup in lib/activityutils.php

This commit is contained in:
Mikael Nordfeldth 2016-01-04 01:58:45 +01:00
parent 00ace6c2df
commit 065e23b1c4
1 changed files with 5 additions and 5 deletions

View File

@ -392,7 +392,8 @@ class ActivityUtils
$object = new Notice(); $object = new Notice();
} }
} }
foreach (array_unique($uris) as $uri) { $uris = array_unique($uris);
foreach ($uris as $uri) {
try { try {
// the exception thrown will cancel before reaching $object // the exception thrown will cancel before reaching $object
$object = call_user_func(array($object, 'fromUri'), $uri); $object = call_user_func(array($object, 'fromUri'), $uri);
@ -401,11 +402,10 @@ class ActivityUtils
common_debug('Could not find local activity object from uri: '.$e->object_uri); common_debug('Could not find local activity object from uri: '.$e->object_uri);
} }
} }
if (!empty($object)) { if (!$object instanceof Managed_DataObject) {
Event::handle('EndFindLocalActivityObject', array($object->getUri(), $type, $object)); throw new ServerException('Could not find any activityobject stored locally with given URIs: '.var_export($uris,true));
} else {
throw new ServerException('Could not find any activityobject stored locally with given URI');
} }
Event::handle('EndFindLocalActivityObject', array($object->getUri(), $object->getObjectType(), $object));
return $object; return $object;
} }