namespace Friendica\Protocol\ActivityPub;
use Friendica\Database\DBA;
+use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Model\Conversation;
use Friendica\Model\Contact;
}
if (($activity['id'] != $activity['reply-to-id']) && !Item::exists(['uri' => $activity['reply-to-id']])) {
- logger('Parent ' . $activity['reply-to-id'] . ' not found. Try to refetch it.');
+ Logger::log('Parent ' . $activity['reply-to-id'] . ' not found. Try to refetch it.');
self::fetchMissingActivity($activity['reply-to-id'], $activity);
}
{
$owner = Contact::getIdForURL($activity['actor']);
- logger('Deleting item ' . $activity['object_id'] . ' from ' . $owner, LOGGER_DEBUG);
+ Logger::log('Deleting item ' . $activity['object_id'] . ' from ' . $owner, LOGGER_DEBUG);
Item::delete(['uri' => $activity['object_id'], 'owner-id' => $owner]);
}
}
$event_id = Event::store($event);
- logger('Event '.$event_id.' was stored', LOGGER_DEBUG);
+ Logger::log('Event '.$event_id.' was stored', LOGGER_DEBUG);
}
/**
/// @todo What to do with $activity['context']?
if (($item['gravity'] != GRAVITY_PARENT) && !Item::exists(['uri' => $item['parent-uri']])) {
- logger('Parent ' . $item['parent-uri'] . ' not found, message will be discarded.', LOGGER_DEBUG);
+ Logger::log('Parent ' . $item['parent-uri'] . ' not found, message will be discarded.', LOGGER_DEBUG);
return;
}
$item['owner-link'] = $activity['actor'];
$item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true);
} else {
- logger('Ignoring actor because of thread completion.', LOGGER_DEBUG);
+ Logger::log('Ignoring actor because of thread completion.', LOGGER_DEBUG);
$item['owner-link'] = $item['author-link'];
$item['owner-id'] = $item['author-id'];
}
}
$item_id = Item::insert($item);
- logger('Storing for user ' . $item['uid'] . ': ' . $item_id);
+ Logger::log('Storing for user ' . $item['uid'] . ': ' . $item_id);
}
}
$object = ActivityPub::fetchContent($url);
if (empty($object)) {
- logger('Activity ' . $url . ' was not fetchable, aborting.');
+ Logger::log('Activity ' . $url . ' was not fetchable, aborting.');
return;
}
$ldactivity['thread-completion'] = true;
ActivityPub\Receiver::processActivity($ldactivity);
- logger('Activity ' . $url . ' had been fetched and processed.');
+ Logger::log('Activity ' . $url . ' had been fetched and processed.');
}
/**
}
DBA::update('contact', ['hub-verify' => $activity['id']], ['id' => $cid]);
- logger('Follow user ' . $uid . ' from contact ' . $cid . ' with id ' . $activity['id']);
+ Logger::log('Follow user ' . $uid . ' from contact ' . $cid . ' with id ' . $activity['id']);
}
/**
return;
}
- logger('Updating profile for ' . $activity['object_id'], LOGGER_DEBUG);
+ Logger::log('Updating profile for ' . $activity['object_id'], LOGGER_DEBUG);
APContact::getByURL($activity['object_id'], true);
}
public static function deletePerson($activity)
{
if (empty($activity['object_id']) || empty($activity['actor'])) {
- logger('Empty object id or actor.', LOGGER_DEBUG);
+ Logger::log('Empty object id or actor.', LOGGER_DEBUG);
return;
}
if ($activity['object_id'] != $activity['actor']) {
- logger('Object id does not match actor.', LOGGER_DEBUG);
+ Logger::log('Object id does not match actor.', LOGGER_DEBUG);
return;
}
}
DBA::close($contacts);
- logger('Deleted contact ' . $activity['object_id'], LOGGER_DEBUG);
+ Logger::log('Deleted contact ' . $activity['object_id'], LOGGER_DEBUG);
}
/**
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
- logger('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
+ Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
return;
}
$condition = ['id' => $cid];
DBA::update('contact', $fields, $condition);
- logger('Accept contact request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Accept contact request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG);
}
/**
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
- logger('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
+ Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
return;
}
if (DBA::exists('contact', ['id' => $cid, 'rel' => Contact::SHARING, 'pending' => true])) {
Contact::remove($cid);
- logger('Rejected contact request from contact ' . $cid . ' for user ' . $uid . ' - contact had been removed.', LOGGER_DEBUG);
+ Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . ' - contact had been removed.', LOGGER_DEBUG);
} else {
- logger('Rejected contact request from contact ' . $cid . ' for user ' . $uid . '.', LOGGER_DEBUG);
+ Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . '.', LOGGER_DEBUG);
}
}
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
- logger('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
+ Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
return;
}
}
Contact::removeFollower($owner, $contact);
- logger('Undo following request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Undo following request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG);
}
/**
return;
}
- logger('Change existing contact ' . $cid . ' from ' . $contact['network'] . ' to ActivityPub.');
+ Logger::log('Change existing contact ' . $cid . ' from ' . $contact['network'] . ' to ActivityPub.');
Contact::updateFromProbe($cid, Protocol::ACTIVITYPUB);
}
}