mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-11 16:54:26 +02:00
Log function
implement log() function.
This commit is contained in:
parent
d6d593d724
commit
14fde5dc9b
122 changed files with 1280 additions and 1161 deletions
|
@ -5,6 +5,7 @@
|
|||
namespace Friendica\Protocol\ActivityPub;
|
||||
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -140,7 +141,7 @@ class Processor
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -158,7 +159,7 @@ class Processor
|
|||
{
|
||||
$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]);
|
||||
}
|
||||
|
||||
|
@ -211,7 +212,7 @@ class Processor
|
|||
}
|
||||
|
||||
$event_id = Event::store($event);
|
||||
logger('Event '.$event_id.' was stored', LOGGER_DEBUG);
|
||||
Logger::log('Event '.$event_id.' was stored', LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,7 +226,7 @@ class Processor
|
|||
/// @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;
|
||||
}
|
||||
|
||||
|
@ -238,7 +239,7 @@ class Processor
|
|||
$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'];
|
||||
}
|
||||
|
@ -284,7 +285,7 @@ class Processor
|
|||
}
|
||||
|
||||
$item_id = Item::insert($item);
|
||||
logger('Storing for user ' . $item['uid'] . ': ' . $item_id);
|
||||
Logger::log('Storing for user ' . $item['uid'] . ': ' . $item_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,7 +303,7 @@ class Processor
|
|||
|
||||
$object = ActivityPub::fetchContent($url);
|
||||
if (empty($object)) {
|
||||
logger('Activity ' . $url . ' was not fetchable, aborting.');
|
||||
Logger::log('Activity ' . $url . ' was not fetchable, aborting.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -322,7 +323,7 @@ class Processor
|
|||
$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.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -360,7 +361,7 @@ class Processor
|
|||
}
|
||||
|
||||
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']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -374,7 +375,7 @@ class Processor
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -386,12 +387,12 @@ class Processor
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -401,7 +402,7 @@ class Processor
|
|||
}
|
||||
DBA::close($contacts);
|
||||
|
||||
logger('Deleted contact ' . $activity['object_id'], LOGGER_DEBUG);
|
||||
Logger::log('Deleted contact ' . $activity['object_id'], LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -420,7 +421,7 @@ class Processor
|
|||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@ -435,7 +436,7 @@ class Processor
|
|||
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -454,7 +455,7 @@ class Processor
|
|||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@ -462,9 +463,9 @@ class Processor
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +508,7 @@ class Processor
|
|||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@ -519,7 +520,7 @@ class Processor
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -534,7 +535,7 @@ class Processor
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Protocol\ActivityPub;
|
|||
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\APContact;
|
||||
|
@ -59,16 +60,16 @@ class Receiver
|
|||
{
|
||||
$http_signer = HTTPSignature::getSigner($body, $header);
|
||||
if (empty($http_signer)) {
|
||||
logger('Invalid HTTP signature, message will be discarded.', LOGGER_DEBUG);
|
||||
Logger::log('Invalid HTTP signature, message will be discarded.', LOGGER_DEBUG);
|
||||
return;
|
||||
} else {
|
||||
logger('HTTP signature is signed by ' . $http_signer, LOGGER_DEBUG);
|
||||
Logger::log('HTTP signature is signed by ' . $http_signer, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$activity = json_decode($body, true);
|
||||
|
||||
if (empty($activity)) {
|
||||
logger('Invalid body.', LOGGER_DEBUG);
|
||||
Logger::log('Invalid body.', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -76,31 +77,31 @@ class Receiver
|
|||
|
||||
$actor = JsonLD::fetchElement($ldactivity, 'as:actor');
|
||||
|
||||
logger('Message for user ' . $uid . ' is from actor ' . $actor, LOGGER_DEBUG);
|
||||
Logger::log('Message for user ' . $uid . ' is from actor ' . $actor, LOGGER_DEBUG);
|
||||
|
||||
if (LDSignature::isSigned($activity)) {
|
||||
$ld_signer = LDSignature::getSigner($activity);
|
||||
if (empty($ld_signer)) {
|
||||
logger('Invalid JSON-LD signature from ' . $actor, LOGGER_DEBUG);
|
||||
Logger::log('Invalid JSON-LD signature from ' . $actor, LOGGER_DEBUG);
|
||||
}
|
||||
if (!empty($ld_signer && ($actor == $http_signer))) {
|
||||
logger('The HTTP and the JSON-LD signature belong to ' . $ld_signer, LOGGER_DEBUG);
|
||||
Logger::log('The HTTP and the JSON-LD signature belong to ' . $ld_signer, LOGGER_DEBUG);
|
||||
$trust_source = true;
|
||||
} elseif (!empty($ld_signer)) {
|
||||
logger('JSON-LD signature is signed by ' . $ld_signer, LOGGER_DEBUG);
|
||||
Logger::log('JSON-LD signature is signed by ' . $ld_signer, LOGGER_DEBUG);
|
||||
$trust_source = true;
|
||||
} elseif ($actor == $http_signer) {
|
||||
logger('Bad JSON-LD signature, but HTTP signer fits the actor.', LOGGER_DEBUG);
|
||||
Logger::log('Bad JSON-LD signature, but HTTP signer fits the actor.', LOGGER_DEBUG);
|
||||
$trust_source = true;
|
||||
} else {
|
||||
logger('Invalid JSON-LD signature and the HTTP signer is different.', LOGGER_DEBUG);
|
||||
Logger::log('Invalid JSON-LD signature and the HTTP signer is different.', LOGGER_DEBUG);
|
||||
$trust_source = false;
|
||||
}
|
||||
} elseif ($actor == $http_signer) {
|
||||
logger('Trusting post without JSON-LD signature, The actor fits the HTTP signer.', LOGGER_DEBUG);
|
||||
Logger::log('Trusting post without JSON-LD signature, The actor fits the HTTP signer.', LOGGER_DEBUG);
|
||||
$trust_source = true;
|
||||
} else {
|
||||
logger('No JSON-LD signature, different actor.', LOGGER_DEBUG);
|
||||
Logger::log('No JSON-LD signature, different actor.', LOGGER_DEBUG);
|
||||
$trust_source = false;
|
||||
}
|
||||
|
||||
|
@ -159,7 +160,7 @@ class Receiver
|
|||
{
|
||||
$actor = JsonLD::fetchElement($activity, 'as:actor');
|
||||
if (empty($actor)) {
|
||||
logger('Empty actor', LOGGER_DEBUG);
|
||||
Logger::log('Empty actor', LOGGER_DEBUG);
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -175,11 +176,11 @@ class Receiver
|
|||
$receivers = array_merge($receivers, $additional);
|
||||
}
|
||||
|
||||
logger('Receivers: ' . json_encode($receivers), LOGGER_DEBUG);
|
||||
Logger::log('Receivers: ' . json_encode($receivers), LOGGER_DEBUG);
|
||||
|
||||
$object_id = JsonLD::fetchElement($activity, 'as:object');
|
||||
if (empty($object_id)) {
|
||||
logger('No object found', LOGGER_DEBUG);
|
||||
Logger::log('No object found', LOGGER_DEBUG);
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -192,7 +193,7 @@ class Receiver
|
|||
}
|
||||
$object_data = self::fetchObject($object_id, $activity['as:object'], $trust_source);
|
||||
if (empty($object_data)) {
|
||||
logger("Object data couldn't be processed", LOGGER_DEBUG);
|
||||
Logger::log("Object data couldn't be processed", LOGGER_DEBUG);
|
||||
return [];
|
||||
}
|
||||
// We had been able to retrieve the object data - so we can trust the source
|
||||
|
@ -229,7 +230,7 @@ class Receiver
|
|||
$object_data['actor'] = $actor;
|
||||
$object_data['receiver'] = array_merge(defaults($object_data, 'receiver', []), $receivers);
|
||||
|
||||
logger('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id'], LOGGER_DEBUG);
|
||||
Logger::log('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id'], LOGGER_DEBUG);
|
||||
|
||||
return $object_data;
|
||||
}
|
||||
|
@ -272,17 +273,17 @@ class Receiver
|
|||
{
|
||||
$type = JsonLD::fetchElement($activity, '@type');
|
||||
if (!$type) {
|
||||
logger('Empty type', LOGGER_DEBUG);
|
||||
Logger::log('Empty type', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!JsonLD::fetchElement($activity, 'as:object')) {
|
||||
logger('Empty object', LOGGER_DEBUG);
|
||||
Logger::log('Empty object', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!JsonLD::fetchElement($activity, 'as:actor')) {
|
||||
logger('Empty actor', LOGGER_DEBUG);
|
||||
Logger::log('Empty actor', LOGGER_DEBUG);
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -290,12 +291,12 @@ class Receiver
|
|||
// $trust_source is called by reference and is set to true if the content was retrieved successfully
|
||||
$object_data = self::prepareObjectData($activity, $uid, $trust_source);
|
||||
if (empty($object_data)) {
|
||||
logger('No object data found', LOGGER_DEBUG);
|
||||
Logger::log('No object data found', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$trust_source) {
|
||||
logger('No trust for activity type "' . $type . '", so we quit now.', LOGGER_DEBUG);
|
||||
Logger::log('No trust for activity type "' . $type . '", so we quit now.', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -384,7 +385,7 @@ class Receiver
|
|||
break;
|
||||
|
||||
default:
|
||||
logger('Unknown activity: ' . $type . ' ' . $object_data['object_type'], LOGGER_DEBUG);
|
||||
Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], LOGGER_DEBUG);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -414,9 +415,9 @@ class Receiver
|
|||
$profile = APContact::getByURL($actor);
|
||||
$followers = defaults($profile, 'followers', '');
|
||||
|
||||
logger('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG);
|
||||
Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG);
|
||||
} else {
|
||||
logger('Empty actor', LOGGER_DEBUG);
|
||||
Logger::log('Empty actor', LOGGER_DEBUG);
|
||||
$followers = '';
|
||||
}
|
||||
|
||||
|
@ -486,7 +487,7 @@ class Receiver
|
|||
return;
|
||||
}
|
||||
|
||||
logger('Switch contact ' . $cid . ' (' . $profile['url'] . ') for user ' . $uid . ' to ActivityPub');
|
||||
Logger::log('Switch contact ' . $cid . ' (' . $profile['url'] . ') for user ' . $uid . ' to ActivityPub');
|
||||
|
||||
$photo = defaults($profile, 'photo', null);
|
||||
unset($profile['photo']);
|
||||
|
@ -500,7 +501,7 @@ class Receiver
|
|||
// Send a new follow request to be sure that the connection still exists
|
||||
if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND]])) {
|
||||
ActivityPub\Transmitter::sendActivity('Follow', $profile['url'], $uid);
|
||||
logger('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, LOGGER_DEBUG);
|
||||
Logger::log('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,27 +571,27 @@ class Receiver
|
|||
$data = ActivityPub::fetchContent($object_id);
|
||||
if (!empty($data)) {
|
||||
$object = JsonLD::compact($data);
|
||||
logger('Fetched content for ' . $object_id, LOGGER_DEBUG);
|
||||
Logger::log('Fetched content for ' . $object_id, LOGGER_DEBUG);
|
||||
} else {
|
||||
logger('Empty content for ' . $object_id . ', check if content is available locally.', LOGGER_DEBUG);
|
||||
Logger::log('Empty content for ' . $object_id . ', check if content is available locally.', LOGGER_DEBUG);
|
||||
|
||||
$item = Item::selectFirst([], ['uri' => $object_id]);
|
||||
if (!DBA::isResult($item)) {
|
||||
logger('Object with url ' . $object_id . ' was not found locally.', LOGGER_DEBUG);
|
||||
Logger::log('Object with url ' . $object_id . ' was not found locally.', LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
logger('Using already stored item for url ' . $object_id, LOGGER_DEBUG);
|
||||
Logger::log('Using already stored item for url ' . $object_id, LOGGER_DEBUG);
|
||||
$data = ActivityPub\Transmitter::createNote($item);
|
||||
$object = JsonLD::compact($data);
|
||||
}
|
||||
} else {
|
||||
logger('Using original object for url ' . $object_id, LOGGER_DEBUG);
|
||||
Logger::log('Using original object for url ' . $object_id, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$type = JsonLD::fetchElement($object, '@type');
|
||||
|
||||
if (empty($type)) {
|
||||
logger('Empty type', LOGGER_DEBUG);
|
||||
Logger::log('Empty type', LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -606,7 +607,7 @@ class Receiver
|
|||
return self::fetchObject($object_id);
|
||||
}
|
||||
|
||||
logger('Unhandled object type: ' . $type, LOGGER_DEBUG);
|
||||
Logger::log('Unhandled object type: ' . $type, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Protocol\ActivityPub;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
use Friendica\Core\Protocol;
|
||||
|
@ -1015,7 +1016,7 @@ class Transmitter
|
|||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
|
||||
logger('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG);
|
||||
Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG);
|
||||
return HTTPSignature::transmit($signed, $inbox, $uid);
|
||||
}
|
||||
|
||||
|
@ -1044,7 +1045,7 @@ class Transmitter
|
|||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
|
||||
logger('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG);
|
||||
Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG);
|
||||
return HTTPSignature::transmit($signed, $inbox, $uid);
|
||||
}
|
||||
|
||||
|
@ -1073,7 +1074,7 @@ class Transmitter
|
|||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
|
||||
logger('Deliver profile update for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG);
|
||||
Logger::log('Deliver profile update for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG);
|
||||
return HTTPSignature::transmit($signed, $inbox, $uid);
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1099,7 @@ class Transmitter
|
|||
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
|
||||
'to' => $profile['url']];
|
||||
|
||||
logger('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, LOGGER_DEBUG);
|
||||
Logger::log('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, LOGGER_DEBUG);
|
||||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
HTTPSignature::transmit($signed, $profile['inbox'], $uid);
|
||||
|
@ -1126,7 +1127,7 @@ class Transmitter
|
|||
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
|
||||
'to' => $profile['url']];
|
||||
|
||||
logger('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
|
||||
Logger::log('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
|
||||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
HTTPSignature::transmit($signed, $profile['inbox'], $uid);
|
||||
|
@ -1154,7 +1155,7 @@ class Transmitter
|
|||
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
|
||||
'to' => $profile['url']];
|
||||
|
||||
logger('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
|
||||
Logger::log('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
|
||||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
HTTPSignature::transmit($signed, $profile['inbox'], $uid);
|
||||
|
@ -1183,7 +1184,7 @@ class Transmitter
|
|||
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
|
||||
'to' => $profile['url']];
|
||||
|
||||
logger('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
|
||||
Logger::log('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
|
||||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
HTTPSignature::transmit($signed, $profile['inbox'], $uid);
|
||||
|
|
|
@ -17,6 +17,7 @@ use Friendica\Content\Text\HTML;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -175,7 +176,7 @@ class DFRN
|
|||
);
|
||||
|
||||
if (! DBA::isResult($r)) {
|
||||
logger(sprintf('No contact found for nickname=%d', $owner_nick), LOGGER_WARNING);
|
||||
Logger::log(sprintf('No contact found for nickname=%d', $owner_nick), LOGGER_WARNING);
|
||||
killme();
|
||||
}
|
||||
|
||||
|
@ -211,7 +212,7 @@ class DFRN
|
|||
);
|
||||
|
||||
if (! DBA::isResult($r)) {
|
||||
logger(sprintf('No contact found for uid=%d', $owner_id), LOGGER_WARNING);
|
||||
Logger::log(sprintf('No contact found for uid=%d', $owner_id), LOGGER_WARNING);
|
||||
killme();
|
||||
}
|
||||
|
||||
|
@ -1171,7 +1172,7 @@ class DFRN
|
|||
if (!$dissolve && !$legacy_transport) {
|
||||
$curlResult = self::transmit($owner, $contact, $atom);
|
||||
if ($curlResult >= 200) {
|
||||
logger('Delivery via Diaspora transport layer was successful with status ' . $curlResult);
|
||||
Logger::log('Delivery via Diaspora transport layer was successful with status ' . $curlResult);
|
||||
return $curlResult;
|
||||
}
|
||||
}
|
||||
|
@ -1188,7 +1189,7 @@ class DFRN
|
|||
$rino = Config::get('system', 'rino_encrypt');
|
||||
$rino = intval($rino);
|
||||
|
||||
logger("Local rino version: ". $rino, LOGGER_DEBUG);
|
||||
Logger::log("Local rino version: ". $rino, LOGGER_DEBUG);
|
||||
|
||||
$ssl_val = intval(Config::get('system', 'ssl_policy'));
|
||||
$ssl_policy = '';
|
||||
|
@ -1208,7 +1209,7 @@ class DFRN
|
|||
|
||||
$url = $contact['notify'] . '&dfrn_id=' . $idtosend . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . (($rino) ? '&rino='.$rino : '');
|
||||
|
||||
logger('dfrn_deliver: ' . $url);
|
||||
Logger::log('dfrn_deliver: ' . $url);
|
||||
|
||||
$curlResult = Network::curl($url);
|
||||
|
||||
|
@ -1225,7 +1226,7 @@ class DFRN
|
|||
return -3; // timed out
|
||||
}
|
||||
|
||||
logger('dfrn_deliver: ' . $xml, LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: ' . $xml, LOGGER_DATA);
|
||||
|
||||
if (empty($xml)) {
|
||||
Contact::markForArchival($contact);
|
||||
|
@ -1233,8 +1234,8 @@ class DFRN
|
|||
}
|
||||
|
||||
if (strpos($xml, '<?xml') === false) {
|
||||
logger('dfrn_deliver: no valid XML returned');
|
||||
logger('dfrn_deliver: returned XML: ' . $xml, LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: no valid XML returned');
|
||||
Logger::log('dfrn_deliver: returned XML: ' . $xml, LOGGER_DATA);
|
||||
Contact::markForArchival($contact);
|
||||
return 3;
|
||||
}
|
||||
|
@ -1261,7 +1262,7 @@ class DFRN
|
|||
$rino_remote_version = intval($res->rino);
|
||||
$page = (($owner['page-flags'] == Contact::PAGE_COMMUNITY) ? 1 : 0);
|
||||
|
||||
logger("Remote rino version: ".$rino_remote_version." for ".$contact["url"], LOGGER_DEBUG);
|
||||
Logger::log("Remote rino version: ".$rino_remote_version." for ".$contact["url"], LOGGER_DEBUG);
|
||||
|
||||
if ($owner['page-flags'] == Contact::PAGE_PRVGROUP) {
|
||||
$page = 2;
|
||||
|
@ -1297,7 +1298,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if ($final_dfrn_id != $orig_id) {
|
||||
logger('dfrn_deliver: wrong dfrn_id.');
|
||||
Logger::log('dfrn_deliver: wrong dfrn_id.');
|
||||
// did not decode properly - cannot trust this site
|
||||
Contact::markForArchival($contact);
|
||||
return 3;
|
||||
|
@ -1325,7 +1326,7 @@ class DFRN
|
|||
|
||||
|
||||
if ($rino > 0 && $rino_remote_version > 0 && (! $dissolve)) {
|
||||
logger('rino version: '. $rino_remote_version);
|
||||
Logger::log('rino version: '. $rino_remote_version);
|
||||
|
||||
switch ($rino_remote_version) {
|
||||
case 1:
|
||||
|
@ -1334,7 +1335,7 @@ class DFRN
|
|||
break;
|
||||
|
||||
default:
|
||||
logger("rino: invalid requested version '$rino_remote_version'");
|
||||
Logger::log("rino: invalid requested version '$rino_remote_version'");
|
||||
Contact::markForArchival($contact);
|
||||
return -8;
|
||||
}
|
||||
|
@ -1359,19 +1360,19 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
logger('md5 rawkey ' . md5($postvars['key']));
|
||||
Logger::log('md5 rawkey ' . md5($postvars['key']));
|
||||
|
||||
$postvars['key'] = bin2hex($postvars['key']);
|
||||
}
|
||||
|
||||
|
||||
logger('dfrn_deliver: ' . "SENDING: " . print_r($postvars, true), LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: ' . "SENDING: " . print_r($postvars, true), LOGGER_DATA);
|
||||
|
||||
$postResult = Network::post($contact['notify'], $postvars);
|
||||
|
||||
$xml = $postResult->getBody();
|
||||
|
||||
logger('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA);
|
||||
|
||||
$curl_stat = $postResult->getReturnCode();
|
||||
if (empty($curl_stat) || empty($xml)) {
|
||||
|
@ -1385,8 +1386,8 @@ class DFRN
|
|||
}
|
||||
|
||||
if (strpos($xml, '<?xml') === false) {
|
||||
logger('dfrn_deliver: phase 2: no valid XML returned');
|
||||
logger('dfrn_deliver: phase 2: returned XML: ' . $xml, LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: phase 2: no valid XML returned');
|
||||
Logger::log('dfrn_deliver: phase 2: returned XML: ' . $xml, LOGGER_DATA);
|
||||
Contact::markForArchival($contact);
|
||||
return 3;
|
||||
}
|
||||
|
@ -1404,7 +1405,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if (!empty($res->message)) {
|
||||
logger('Delivery returned status '.$res->status.' - '.$res->message, LOGGER_DEBUG);
|
||||
Logger::log('Delivery returned status '.$res->status.' - '.$res->message, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
if (($res->status >= 200) && ($res->status <= 299)) {
|
||||
|
@ -1429,14 +1430,14 @@ class DFRN
|
|||
|
||||
if (!$public_batch) {
|
||||
if (empty($contact['addr'])) {
|
||||
logger('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
|
||||
Logger::log('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
|
||||
if (Contact::updateFromProbe($contact['id'])) {
|
||||
$new_contact = DBA::selectFirst('contact', ['addr'], ['id' => $contact['id']]);
|
||||
$contact['addr'] = $new_contact['addr'];
|
||||
}
|
||||
|
||||
if (empty($contact['addr'])) {
|
||||
logger('Unable to find contact handle for ' . $contact['id'] . ' - ' . $contact['url']);
|
||||
Logger::log('Unable to find contact handle for ' . $contact['id'] . ' - ' . $contact['url']);
|
||||
Contact::markForArchival($contact);
|
||||
return -21;
|
||||
}
|
||||
|
@ -1444,7 +1445,7 @@ class DFRN
|
|||
|
||||
$fcontact = Diaspora::personByHandle($contact['addr']);
|
||||
if (empty($fcontact)) {
|
||||
logger('Unable to find contact details for ' . $contact['id'] . ' - ' . $contact['addr']);
|
||||
Logger::log('Unable to find contact details for ' . $contact['id'] . ' - ' . $contact['addr']);
|
||||
Contact::markForArchival($contact);
|
||||
return -22;
|
||||
}
|
||||
|
@ -1473,7 +1474,7 @@ class DFRN
|
|||
|
||||
$curl_stat = $postResult->getReturnCode();
|
||||
if (empty($curl_stat) || empty($xml)) {
|
||||
logger('Empty answer from ' . $contact['id'] . ' - ' . $dest_url);
|
||||
Logger::log('Empty answer from ' . $contact['id'] . ' - ' . $dest_url);
|
||||
Contact::markForArchival($contact);
|
||||
return -9; // timed out
|
||||
}
|
||||
|
@ -1484,8 +1485,8 @@ class DFRN
|
|||
}
|
||||
|
||||
if (strpos($xml, '<?xml') === false) {
|
||||
logger('No valid XML returned from ' . $contact['id'] . ' - ' . $dest_url);
|
||||
logger('Returned XML: ' . $xml, LOGGER_DATA);
|
||||
Logger::log('No valid XML returned from ' . $contact['id'] . ' - ' . $dest_url);
|
||||
Logger::log('Returned XML: ' . $xml, LOGGER_DATA);
|
||||
Contact::markForArchival($contact);
|
||||
return 3;
|
||||
}
|
||||
|
@ -1498,7 +1499,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if (!empty($res->message)) {
|
||||
logger('Transmit to ' . $dest_url . ' returned status '.$res->status.' - '.$res->message, LOGGER_DEBUG);
|
||||
Logger::log('Transmit to ' . $dest_url . ' returned status '.$res->status.' - '.$res->message, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
if (($res->status >= 200) && ($res->status <= 299)) {
|
||||
|
@ -1525,7 +1526,7 @@ class DFRN
|
|||
return;
|
||||
}
|
||||
|
||||
logger('updating birthday: ' . $birthday . ' for contact ' . $contact['id']);
|
||||
Logger::log('updating birthday: ' . $birthday . ' for contact ' . $contact['id']);
|
||||
|
||||
$bdtext = L10n::t('%s\'s birthday', $contact['name']);
|
||||
$bdtext2 = L10n::t('Happy Birthday %s', ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]');
|
||||
|
@ -1575,7 +1576,7 @@ class DFRN
|
|||
$author["network"] = $contact_old["network"];
|
||||
} else {
|
||||
if (!$onlyfetch) {
|
||||
logger("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml, LOGGER_DEBUG);
|
||||
Logger::log("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$author["contact-unknown"] = true;
|
||||
|
@ -1624,11 +1625,11 @@ class DFRN
|
|||
}
|
||||
|
||||
if (empty($author['avatar'])) {
|
||||
logger('Empty author: ' . $xml);
|
||||
Logger::log('Empty author: ' . $xml);
|
||||
}
|
||||
|
||||
if (DBA::isResult($contact_old) && !$onlyfetch) {
|
||||
logger("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", LOGGER_DEBUG);
|
||||
Logger::log("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", LOGGER_DEBUG);
|
||||
|
||||
$poco = ["url" => $contact_old["url"]];
|
||||
|
||||
|
@ -1689,7 +1690,7 @@ class DFRN
|
|||
// If the "hide" element is present then the profile isn't searchable.
|
||||
$hide = intval(XML::getFirstNodeValue($xpath, $element . "/dfrn:hide/text()", $context) == "true");
|
||||
|
||||
logger("Hidden status for contact " . $contact_old["url"] . ": " . $hide, LOGGER_DEBUG);
|
||||
Logger::log("Hidden status for contact " . $contact_old["url"] . ": " . $hide, LOGGER_DEBUG);
|
||||
|
||||
// If the contact isn't searchable then set the contact to "hidden".
|
||||
// Problem: This can be manually overridden by the user.
|
||||
|
@ -1761,20 +1762,20 @@ class DFRN
|
|||
$contact[$field] = DateTimeFormat::utc($contact[$field]);
|
||||
|
||||
if (strtotime($contact[$field]) > strtotime($contact_old[$field])) {
|
||||
logger("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", LOGGER_DEBUG);
|
||||
Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", LOGGER_DEBUG);
|
||||
$update = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($fields as $field => $data) {
|
||||
if ($contact[$field] != $contact_old[$field]) {
|
||||
logger("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", LOGGER_DEBUG);
|
||||
Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", LOGGER_DEBUG);
|
||||
$update = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($update) {
|
||||
logger("Update contact data for contact " . $contact["id"] . " (" . $contact["nick"] . ")", LOGGER_DEBUG);
|
||||
Logger::log("Update contact data for contact " . $contact["id"] . " (" . $contact["nick"] . ")", LOGGER_DEBUG);
|
||||
|
||||
q(
|
||||
"UPDATE `contact` SET `name` = '%s', `nick` = '%s', `about` = '%s', `location` = '%s',
|
||||
|
@ -1881,7 +1882,7 @@ class DFRN
|
|||
*/
|
||||
private static function processMail($xpath, $mail, $importer)
|
||||
{
|
||||
logger("Processing mails");
|
||||
Logger::log("Processing mails");
|
||||
|
||||
/// @TODO Rewrite this to one statement
|
||||
$msg = [];
|
||||
|
@ -1921,7 +1922,7 @@ class DFRN
|
|||
|
||||
notification($notif_params);
|
||||
|
||||
logger("Mail is processed, notification was sent.");
|
||||
Logger::log("Mail is processed, notification was sent.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1937,7 +1938,7 @@ class DFRN
|
|||
{
|
||||
$a = get_app();
|
||||
|
||||
logger("Processing suggestions");
|
||||
Logger::log("Processing suggestions");
|
||||
|
||||
/// @TODO Rewrite this to one statement
|
||||
$suggest = [];
|
||||
|
@ -2053,7 +2054,7 @@ class DFRN
|
|||
*/
|
||||
private static function processRelocation($xpath, $relocation, $importer)
|
||||
{
|
||||
logger("Processing relocations");
|
||||
Logger::log("Processing relocations");
|
||||
|
||||
/// @TODO Rewrite this to one statement
|
||||
$relocate = [];
|
||||
|
@ -2088,7 +2089,7 @@ class DFRN
|
|||
);
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
logger("Query failed to execute, no result returned in " . __FUNCTION__);
|
||||
Logger::log("Query failed to execute, no result returned in " . __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2115,7 +2116,7 @@ class DFRN
|
|||
|
||||
Contact::updateAvatar($relocate["avatar"], $importer["importer_uid"], $importer["id"], true);
|
||||
|
||||
logger('Contacts are updated.');
|
||||
Logger::log('Contacts are updated.');
|
||||
|
||||
/// @TODO
|
||||
/// merge with current record, current contents have priority
|
||||
|
@ -2174,7 +2175,7 @@ class DFRN
|
|||
if ($importer["page-flags"] == Contact::PAGE_COMMUNITY || $importer["page-flags"] == Contact::PAGE_PRVGROUP) {
|
||||
$sql_extra = "";
|
||||
$community = true;
|
||||
logger("possible community action");
|
||||
Logger::log("possible community action");
|
||||
} else {
|
||||
$sql_extra = " AND `contact`.`self` AND `item`.`wall` ";
|
||||
}
|
||||
|
@ -2211,7 +2212,7 @@ class DFRN
|
|||
*/
|
||||
if ($is_a_remote_action && $community && (!$r[0]["forum_mode"]) && (!$r[0]["wall"])) {
|
||||
$is_a_remote_action = false;
|
||||
logger("not a community action");
|
||||
Logger::log("not a community action");
|
||||
}
|
||||
|
||||
if ($is_a_remote_action) {
|
||||
|
@ -2298,7 +2299,7 @@ class DFRN
|
|||
*/
|
||||
private static function processVerbs($entrytype, $importer, &$item, &$is_like)
|
||||
{
|
||||
logger("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);
|
||||
Logger::log("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);
|
||||
|
||||
if (($entrytype == DFRN::TOP_LEVEL)) {
|
||||
// The filling of the the "contact" variable is done for legcy reasons
|
||||
|
@ -2310,22 +2311,22 @@ class DFRN
|
|||
// Big question: Do we need these functions? They were part of the "consume_feed" function.
|
||||
// This function once was responsible for DFRN and OStatus.
|
||||
if (activity_match($item["verb"], ACTIVITY_FOLLOW)) {
|
||||
logger("New follower");
|
||||
Logger::log("New follower");
|
||||
Contact::addRelationship($importer, $contact, $item, $nickname);
|
||||
return false;
|
||||
}
|
||||
if (activity_match($item["verb"], ACTIVITY_UNFOLLOW)) {
|
||||
logger("Lost follower");
|
||||
Logger::log("Lost follower");
|
||||
Contact::removeFollower($importer, $contact, $item);
|
||||
return false;
|
||||
}
|
||||
if (activity_match($item["verb"], ACTIVITY_REQ_FRIEND)) {
|
||||
logger("New friend request");
|
||||
Logger::log("New friend request");
|
||||
Contact::addRelationship($importer, $contact, $item, $nickname, true);
|
||||
return false;
|
||||
}
|
||||
if (activity_match($item["verb"], ACTIVITY_UNFRIEND)) {
|
||||
logger("Lost sharer");
|
||||
Logger::log("Lost sharer");
|
||||
Contact::removeSharer($importer, $contact, $item);
|
||||
return false;
|
||||
}
|
||||
|
@ -2369,7 +2370,7 @@ class DFRN
|
|||
$item_tag = Item::selectFirst(['id', 'tag'], ['uri' => $xt->id, 'uid' => $importer["importer_uid"]]);
|
||||
|
||||
if (!DBA::isResult($item_tag)) {
|
||||
logger("Query failed to execute, no result returned in " . __FUNCTION__);
|
||||
Logger::log("Query failed to execute, no result returned in " . __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2445,7 +2446,7 @@ class DFRN
|
|||
*/
|
||||
private static function processEntry($header, $xpath, $entry, $importer, $xml)
|
||||
{
|
||||
logger("Processing entries");
|
||||
Logger::log("Processing entries");
|
||||
|
||||
$item = $header;
|
||||
|
||||
|
@ -2463,7 +2464,7 @@ class DFRN
|
|||
);
|
||||
// Is there an existing item?
|
||||
if (DBA::isResult($current) && !self::isEditedTimestampNewer($current, $item)) {
|
||||
logger("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG);
|
||||
Logger::log("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2671,10 +2672,10 @@ class DFRN
|
|||
|
||||
// Is it an event?
|
||||
if (($item["object-type"] == ACTIVITY_OBJ_EVENT) && !$owner_unknown) {
|
||||
logger("Item ".$item["uri"]." seems to contain an event.", LOGGER_DEBUG);
|
||||
Logger::log("Item ".$item["uri"]." seems to contain an event.", LOGGER_DEBUG);
|
||||
$ev = Event::fromBBCode($item["body"]);
|
||||
if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) {
|
||||
logger("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG);
|
||||
Logger::log("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG);
|
||||
$ev["cid"] = $importer["id"];
|
||||
$ev["uid"] = $importer["importer_uid"];
|
||||
$ev["uri"] = $item["uri"];
|
||||
|
@ -2690,20 +2691,20 @@ class DFRN
|
|||
}
|
||||
|
||||
$event_id = Event::store($ev);
|
||||
logger("Event ".$event_id." was stored", LOGGER_DEBUG);
|
||||
Logger::log("Event ".$event_id." was stored", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!self::processVerbs($entrytype, $importer, $item, $is_like)) {
|
||||
logger("Exiting because 'processVerbs' told us so", LOGGER_DEBUG);
|
||||
Logger::log("Exiting because 'processVerbs' told us so", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
// This check is done here to be able to receive connection requests in "processVerbs"
|
||||
if (($entrytype == DFRN::TOP_LEVEL) && $owner_unknown) {
|
||||
logger("Item won't be stored because user " . $importer["importer_uid"] . " doesn't follow " . $item["owner-link"] . ".", LOGGER_DEBUG);
|
||||
Logger::log("Item won't be stored because user " . $importer["importer_uid"] . " doesn't follow " . $item["owner-link"] . ".", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2711,9 +2712,9 @@ class DFRN
|
|||
// Update content if 'updated' changes
|
||||
if (DBA::isResult($current)) {
|
||||
if (self::updateContent($current, $item, $importer, $entrytype)) {
|
||||
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
|
||||
Logger::log("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
|
||||
} else {
|
||||
logger("Item " . $item["uri"] . " already existed.", LOGGER_DEBUG);
|
||||
Logger::log("Item " . $item["uri"] . " already existed.", LOGGER_DEBUG);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2723,7 +2724,7 @@ class DFRN
|
|||
$parent = 0;
|
||||
|
||||
if ($posted_id) {
|
||||
logger("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, LOGGER_DEBUG);
|
||||
Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, LOGGER_DEBUG);
|
||||
|
||||
if ($item['uid'] == 0) {
|
||||
Item::distribute($posted_id);
|
||||
|
@ -2733,7 +2734,7 @@ class DFRN
|
|||
}
|
||||
} else { // $entrytype == DFRN::TOP_LEVEL
|
||||
if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) {
|
||||
logger("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG);
|
||||
Logger::log("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
if (!link_compare($item["owner-link"], $importer["url"])) {
|
||||
|
@ -2743,13 +2744,13 @@ class DFRN
|
|||
* the tgroup delivery code called from Item::insert will correct it if it's a forum,
|
||||
* but we're going to unconditionally correct it here so that the post will always be owned by our contact.
|
||||
*/
|
||||
logger('Correcting item owner.', LOGGER_DEBUG);
|
||||
Logger::log('Correcting item owner.', LOGGER_DEBUG);
|
||||
$item["owner-link"] = $importer["url"];
|
||||
$item["owner-id"] = Contact::getIdForURL($importer["url"], 0);
|
||||
}
|
||||
|
||||
if (($importer["rel"] == Contact::FOLLOWER) && (!self::tgroupCheck($importer["importer_uid"], $item))) {
|
||||
logger("Contact ".$importer["id"]." is only follower and tgroup check was negative.", LOGGER_DEBUG);
|
||||
Logger::log("Contact ".$importer["id"]." is only follower and tgroup check was negative.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2763,7 +2764,7 @@ class DFRN
|
|||
$posted_id = $notify;
|
||||
}
|
||||
|
||||
logger("Item was stored with id ".$posted_id, LOGGER_DEBUG);
|
||||
Logger::log("Item was stored with id ".$posted_id, LOGGER_DEBUG);
|
||||
|
||||
if ($item['uid'] == 0) {
|
||||
Item::distribute($posted_id);
|
||||
|
@ -2786,7 +2787,7 @@ class DFRN
|
|||
*/
|
||||
private static function processDeletion($xpath, $deletion, $importer)
|
||||
{
|
||||
logger("Processing deletions");
|
||||
Logger::log("Processing deletions");
|
||||
$uri = null;
|
||||
|
||||
foreach ($deletion->attributes as $attributes) {
|
||||
|
@ -2802,18 +2803,18 @@ class DFRN
|
|||
$condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
|
||||
$item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition);
|
||||
if (!DBA::isResult($item)) {
|
||||
logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr($item['file'], '[')) {
|
||||
logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " is filed. So it won't be deleted.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " is filed. So it won't be deleted.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
// When it is a starting post it has to belong to the person that wants to delete it
|
||||
if (($item['id'] == $item['parent']) && ($item['contact-id'] != $importer["id"])) {
|
||||
logger("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2821,7 +2822,7 @@ class DFRN
|
|||
if (($item['id'] != $item['parent']) && ($item['contact-id'] != $importer["id"])) {
|
||||
$condition = ['id' => $item['parent'], 'contact-id' => $importer["id"]];
|
||||
if (!Item::exists($condition)) {
|
||||
logger("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2830,7 +2831,7 @@ class DFRN
|
|||
return;
|
||||
}
|
||||
|
||||
logger('deleting item '.$item['id'].' uri='.$uri, LOGGER_DEBUG);
|
||||
Logger::log('deleting item '.$item['id'].' uri='.$uri, LOGGER_DEBUG);
|
||||
|
||||
Item::delete(['id' => $item['id']]);
|
||||
}
|
||||
|
@ -2884,7 +2885,7 @@ class DFRN
|
|||
self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml);
|
||||
}
|
||||
|
||||
logger("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
|
||||
Logger::log("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
|
||||
|
||||
// is it a public forum? Private forums aren't exposed with this method
|
||||
$forum = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:community/text()"));
|
||||
|
@ -2950,7 +2951,7 @@ class DFRN
|
|||
self::processEntry($header, $xpath, $entry, $importer, $xml);
|
||||
}
|
||||
}
|
||||
logger("Import done for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
|
||||
Logger::log("Import done for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
@ -3035,7 +3036,7 @@ class DFRN
|
|||
|
||||
$url = curPageURL();
|
||||
|
||||
logger('auto_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
|
||||
Logger::log('auto_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
|
||||
$dest = (($url) ? '&destination_url=' . $url : '');
|
||||
System::externalRedirect($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
|
||||
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest);
|
||||
|
@ -3090,7 +3091,7 @@ class DFRN
|
|||
foreach ($matches as $mtch) {
|
||||
if (link_compare($link, $mtch[1]) || link_compare($dlink, $mtch[1])) {
|
||||
$mention = true;
|
||||
logger('mention found: ' . $mtch[2]);
|
||||
Logger::log('mention found: ' . $mtch[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
namespace Friendica\Protocol;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Protocol;
|
||||
|
||||
|
@ -28,12 +29,12 @@ class Email
|
|||
|
||||
$errors = imap_errors();
|
||||
if (!empty($errors)) {
|
||||
logger('IMAP Errors occured: ' . json_encode($errors));
|
||||
Logger::log('IMAP Errors occured: ' . json_encode($errors));
|
||||
}
|
||||
|
||||
$alerts = imap_alerts();
|
||||
if (!empty($alerts)) {
|
||||
logger('IMAP Alerts occured: ' . json_encode($alerts));
|
||||
Logger::log('IMAP Alerts occured: ' . json_encode($alerts));
|
||||
}
|
||||
|
||||
return $mbox;
|
||||
|
@ -54,21 +55,21 @@ class Email
|
|||
if (!$search1) {
|
||||
$search1 = [];
|
||||
} else {
|
||||
logger("Found mails from ".$email_addr, LOGGER_DEBUG);
|
||||
Logger::log("Found mails from ".$email_addr, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$search2 = @imap_search($mbox, 'TO "' . $email_addr . '"', SE_UID);
|
||||
if (!$search2) {
|
||||
$search2 = [];
|
||||
} else {
|
||||
logger("Found mails to ".$email_addr, LOGGER_DEBUG);
|
||||
Logger::log("Found mails to ".$email_addr, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$search3 = @imap_search($mbox, 'CC "' . $email_addr . '"', SE_UID);
|
||||
if (!$search3) {
|
||||
$search3 = [];
|
||||
} else {
|
||||
logger("Found mails cc ".$email_addr, LOGGER_DEBUG);
|
||||
Logger::log("Found mails cc ".$email_addr, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$res = array_unique(array_merge($search1, $search2, $search3));
|
||||
|
@ -351,7 +352,7 @@ class Email
|
|||
|
||||
//$message = '<html><body>' . $html . '</body></html>';
|
||||
//$message = html2plain($html);
|
||||
logger('notifier: email delivery to ' . $addr);
|
||||
Logger::log('notifier: email delivery to ' . $addr);
|
||||
mail($addr, $subject, $body, $headers);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Friendica\Protocol;
|
|||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -40,12 +41,12 @@ class Feed {
|
|||
$a = get_app();
|
||||
|
||||
if (!$simulate) {
|
||||
logger("Import Atom/RSS feed '".$contact["name"]."' (Contact ".$contact["id"].") for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Import Atom/RSS feed '".$contact["name"]."' (Contact ".$contact["id"].") for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
} else {
|
||||
logger("Test Atom/RSS feed", LOGGER_DEBUG);
|
||||
Logger::log("Test Atom/RSS feed", LOGGER_DEBUG);
|
||||
}
|
||||
if (empty($xml)) {
|
||||
logger('XML is empty.', LOGGER_DEBUG);
|
||||
Logger::log('XML is empty.', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -199,7 +200,7 @@ class Feed {
|
|||
$header["contact-id"] = $contact["id"];
|
||||
|
||||
if (!is_object($entries)) {
|
||||
logger("There are no entries in this feed.", LOGGER_DEBUG);
|
||||
Logger::log("There are no entries in this feed.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -248,7 +249,7 @@ class Feed {
|
|||
$importer["uid"], $item["uri"], Protocol::FEED, Protocol::DFRN];
|
||||
$previous = Item::selectFirst(['id'], $condition);
|
||||
if (DBA::isResult($previous)) {
|
||||
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
|
||||
Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +424,7 @@ class Feed {
|
|||
}
|
||||
|
||||
if (!$simulate) {
|
||||
logger("Stored feed: ".print_r($item, true), LOGGER_DEBUG);
|
||||
Logger::log("Stored feed: ".print_r($item, true), LOGGER_DEBUG);
|
||||
|
||||
$notify = Item::isRemoteSelf($contact, $item);
|
||||
|
||||
|
@ -440,7 +441,7 @@ class Feed {
|
|||
|
||||
$id = Item::insert($item, false, $notify);
|
||||
|
||||
logger("Feed for contact ".$contact["url"]." stored under id ".$id);
|
||||
Logger::log("Feed for contact ".$contact["url"]." stored under id ".$id);
|
||||
} else {
|
||||
$items[] = $item;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Content\Text\HTML;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Lock;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
|
@ -195,7 +196,7 @@ class OStatus
|
|||
DBA::update('contact', $contact, ['id' => $contact["id"]], $current);
|
||||
|
||||
if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) {
|
||||
logger("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
|
||||
Logger::log("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
|
||||
Contact::updateAvatar($author["author-avatar"], $importer["uid"], $contact["id"]);
|
||||
}
|
||||
|
||||
|
@ -322,7 +323,7 @@ class OStatus
|
|||
self::$conv_list = [];
|
||||
}
|
||||
|
||||
logger('Import OStatus message for user ' . $importer['uid'], LOGGER_DEBUG);
|
||||
Logger::log('Import OStatus message for user ' . $importer['uid'], LOGGER_DEBUG);
|
||||
|
||||
if ($xml == "") {
|
||||
return false;
|
||||
|
@ -348,7 +349,7 @@ class OStatus
|
|||
foreach ($hub_attributes as $hub_attribute) {
|
||||
if ($hub_attribute->name == "href") {
|
||||
$hub = $hub_attribute->textContent;
|
||||
logger("Found hub ".$hub, LOGGER_DEBUG);
|
||||
Logger::log("Found hub ".$hub, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -433,27 +434,27 @@ class OStatus
|
|||
|
||||
if (in_array($item["verb"], [NAMESPACE_OSTATUS."/unfavorite", ACTIVITY_UNFAVORITE])) {
|
||||
// Ignore "Unfavorite" message
|
||||
logger("Ignore unfavorite message ".print_r($item, true), LOGGER_DEBUG);
|
||||
Logger::log("Ignore unfavorite message ".print_r($item, true), LOGGER_DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Deletions come with the same uri, so we check for duplicates after processing deletions
|
||||
if (Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]])) {
|
||||
logger('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', LOGGER_DEBUG);
|
||||
Logger::log('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', LOGGER_DEBUG);
|
||||
continue;
|
||||
} else {
|
||||
logger('Processing post with URI '.$item["uri"].' for user '.$importer["uid"].'.', LOGGER_DEBUG);
|
||||
Logger::log('Processing post with URI '.$item["uri"].' for user '.$importer["uid"].'.', LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
if ($item["verb"] == ACTIVITY_JOIN) {
|
||||
// ignore "Join" messages
|
||||
logger("Ignore join message ".print_r($item, true), LOGGER_DEBUG);
|
||||
Logger::log("Ignore join message ".print_r($item, true), LOGGER_DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item["verb"] == "http://mastodon.social/schema/1.0/block") {
|
||||
// ignore mastodon "block" messages
|
||||
logger("Ignore block message ".print_r($item, true), LOGGER_DEBUG);
|
||||
Logger::log("Ignore block message ".print_r($item, true), LOGGER_DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -470,7 +471,7 @@ class OStatus
|
|||
|
||||
if ($item["verb"] == ACTIVITY_FAVORITE) {
|
||||
$orig_uri = $xpath->query("activity:object/atom:id", $entry)->item(0)->nodeValue;
|
||||
logger("Favorite ".$orig_uri." ".print_r($item, true));
|
||||
Logger::log("Favorite ".$orig_uri." ".print_r($item, true));
|
||||
|
||||
$item["verb"] = ACTIVITY_LIKE;
|
||||
$item["parent-uri"] = $orig_uri;
|
||||
|
@ -480,7 +481,7 @@ class OStatus
|
|||
|
||||
// http://activitystrea.ms/schema/1.0/rsvp-yes
|
||||
if (!in_array($item["verb"], [ACTIVITY_POST, ACTIVITY_LIKE, ACTIVITY_SHARE])) {
|
||||
logger("Unhandled verb ".$item["verb"]." ".print_r($item, true), LOGGER_DEBUG);
|
||||
Logger::log("Unhandled verb ".$item["verb"]." ".print_r($item, true), LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
self::processPost($xpath, $entry, $item, $importer);
|
||||
|
@ -493,10 +494,10 @@ class OStatus
|
|||
// If not, then it depends on this setting
|
||||
$valid = !Config::get('system', 'ostatus_full_threads');
|
||||
if ($valid) {
|
||||
logger("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", LOGGER_DEBUG);
|
||||
}
|
||||
} else {
|
||||
logger("Item with uri ".self::$itemlist[0]['uri']." belongs to a contact (".self::$itemlist[0]['contact-id']."). It will be imported.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri ".self::$itemlist[0]['uri']." belongs to a contact (".self::$itemlist[0]['contact-id']."). It will be imported.", LOGGER_DEBUG);
|
||||
}
|
||||
if ($valid) {
|
||||
// Never post a thread when the only interaction by our contact was a like
|
||||
|
@ -508,14 +509,14 @@ class OStatus
|
|||
}
|
||||
}
|
||||
if ($valid) {
|
||||
logger("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// But we will only import complete threads
|
||||
$valid = Item::exists(['uid' => $importer["uid"], 'uri' => self::$itemlist[0]['parent-uri']]);
|
||||
if ($valid) {
|
||||
logger("Item with uri ".self::$itemlist[0]["uri"]." belongs to parent ".self::$itemlist[0]['parent-uri']." of user ".$importer["uid"].". It will be imported.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri ".self::$itemlist[0]["uri"]." belongs to parent ".self::$itemlist[0]['parent-uri']." of user ".$importer["uid"].". It will be imported.", LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -532,25 +533,25 @@ class OStatus
|
|||
foreach (self::$itemlist as $item) {
|
||||
$found = Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]]);
|
||||
if ($found) {
|
||||
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already exists.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already exists.", LOGGER_DEBUG);
|
||||
} elseif ($item['contact-id'] < 0) {
|
||||
logger("Item with uri ".$item["uri"]." is from a blocked contact.", LOGGER_DEBUG);
|
||||
Logger::log("Item with uri ".$item["uri"]." is from a blocked contact.", LOGGER_DEBUG);
|
||||
} else {
|
||||
// We are having duplicated entries. Hopefully this solves it.
|
||||
if (Lock::acquire('ostatus_process_item_insert')) {
|
||||
$ret = Item::insert($item);
|
||||
Lock::release('ostatus_process_item_insert');
|
||||
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
|
||||
Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
|
||||
} else {
|
||||
$ret = Item::insert($item);
|
||||
logger("We couldn't lock - but tried to store the item anyway. Return value is ".$ret);
|
||||
Logger::log("We couldn't lock - but tried to store the item anyway. Return value is ".$ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self::$itemlist = [];
|
||||
}
|
||||
logger('Processing done for post with URI '.$item["uri"].' for user '.$importer["uid"].'.', LOGGER_DEBUG);
|
||||
Logger::log('Processing done for post with URI '.$item["uri"].' for user '.$importer["uid"].'.', LOGGER_DEBUG);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -564,13 +565,13 @@ class OStatus
|
|||
{
|
||||
$condition = ['uid' => $item['uid'], 'author-id' => $item['author-id'], 'uri' => $item['uri']];
|
||||
if (!Item::exists($condition)) {
|
||||
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it.");
|
||||
Logger::log('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it.");
|
||||
return;
|
||||
}
|
||||
|
||||
Item::delete($condition);
|
||||
|
||||
logger('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
|
||||
Logger::log('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -706,7 +707,7 @@ class OStatus
|
|||
self::fetchRelated($related, $item["parent-uri"], $importer);
|
||||
}
|
||||
} else {
|
||||
logger('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', LOGGER_DEBUG);
|
||||
Logger::log('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', LOGGER_DEBUG);
|
||||
}
|
||||
} else {
|
||||
$item["parent-uri"] = $item["uri"];
|
||||
|
@ -852,11 +853,11 @@ class OStatus
|
|||
|
||||
$condition = ['item-uri' => $conv_data['uri'],'protocol' => Conversation::PARCEL_FEED];
|
||||
if (DBA::exists('conversation', $condition)) {
|
||||
logger('Delete deprecated entry for URI '.$conv_data['uri'], LOGGER_DEBUG);
|
||||
Logger::log('Delete deprecated entry for URI '.$conv_data['uri'], LOGGER_DEBUG);
|
||||
DBA::delete('conversation', ['item-uri' => $conv_data['uri']]);
|
||||
}
|
||||
|
||||
logger('Store conversation data for uri '.$conv_data['uri'], LOGGER_DEBUG);
|
||||
Logger::log('Store conversation data for uri '.$conv_data['uri'], LOGGER_DEBUG);
|
||||
Conversation::insert($conv_data);
|
||||
}
|
||||
}
|
||||
|
@ -876,7 +877,7 @@ class OStatus
|
|||
{
|
||||
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $self, Conversation::PARCEL_DFRN, Conversation::PARCEL_SALMON];
|
||||
if (DBA::exists('conversation', $condition)) {
|
||||
logger('Conversation '.$item['uri'].' is already stored.', LOGGER_DEBUG);
|
||||
Logger::log('Conversation '.$item['uri'].' is already stored.', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -896,7 +897,7 @@ class OStatus
|
|||
$item["protocol"] = Conversation::PARCEL_SALMON;
|
||||
$item["source"] = $xml;
|
||||
|
||||
logger('Conversation '.$item['uri'].' is now fetched.', LOGGER_DEBUG);
|
||||
Logger::log('Conversation '.$item['uri'].' is now fetched.', LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -915,11 +916,11 @@ class OStatus
|
|||
$stored = true;
|
||||
$xml = $conversation['source'];
|
||||
if (self::process($xml, $importer, $contact, $hub, $stored, false)) {
|
||||
logger('Got valid cached XML for URI '.$related_uri, LOGGER_DEBUG);
|
||||
Logger::log('Got valid cached XML for URI '.$related_uri, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
if ($conversation['protocol'] == Conversation::PARCEL_SALMON) {
|
||||
logger('Delete invalid cached XML for URI '.$related_uri, LOGGER_DEBUG);
|
||||
Logger::log('Delete invalid cached XML for URI '.$related_uri, LOGGER_DEBUG);
|
||||
DBA::delete('conversation', ['item-uri' => $related_uri]);
|
||||
}
|
||||
}
|
||||
|
@ -934,7 +935,7 @@ class OStatus
|
|||
$xml = '';
|
||||
|
||||
if (stristr($curlResult->getHeader(), 'Content-Type: application/atom+xml')) {
|
||||
logger('Directly fetched XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
Logger::log('Directly fetched XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
$xml = $curlResult->getBody();
|
||||
}
|
||||
|
||||
|
@ -959,7 +960,7 @@ class OStatus
|
|||
$curlResult = Network::curl($atom_file);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
logger('Fetched XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
Logger::log('Fetched XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
$xml = $curlResult->getBody();
|
||||
}
|
||||
}
|
||||
|
@ -971,7 +972,7 @@ class OStatus
|
|||
$curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related).'.atom');
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
logger('GNU Social workaround to fetch XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
$xml = $curlResult->getBody();
|
||||
}
|
||||
}
|
||||
|
@ -982,7 +983,7 @@ class OStatus
|
|||
$curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom');
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
logger('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
$xml = $curlResult->getBody();
|
||||
}
|
||||
}
|
||||
|
@ -993,7 +994,7 @@ class OStatus
|
|||
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
|
||||
if (DBA::isResult($conversation)) {
|
||||
$stored = true;
|
||||
logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
|
||||
Logger::log('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
|
||||
$xml = $conversation['source'];
|
||||
}
|
||||
}
|
||||
|
@ -1001,7 +1002,7 @@ class OStatus
|
|||
if ($xml != '') {
|
||||
self::process($xml, $importer, $contact, $hub, $stored, false);
|
||||
} else {
|
||||
logger("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related, LOGGER_DEBUG);
|
||||
Logger::log("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related, LOGGER_DEBUG);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1651,7 +1652,7 @@ class OStatus
|
|||
private static function reshareEntry(DOMDocument $doc, array $item, array $owner, $repeated_guid, $toplevel)
|
||||
{
|
||||
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
||||
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
|
||||
|
@ -1714,7 +1715,7 @@ class OStatus
|
|||
private static function likeEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
|
||||
{
|
||||
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
||||
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
|
||||
|
@ -1861,7 +1862,7 @@ class OStatus
|
|||
private static function noteEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
|
||||
{
|
||||
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
||||
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
|
||||
|
@ -2152,7 +2153,7 @@ class OStatus
|
|||
if ((time() - strtotime($owner['last-item'])) < 15*60) {
|
||||
$result = Cache::get($cachekey);
|
||||
if (!$nocache && !is_null($result)) {
|
||||
logger('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)', LOGGER_DEBUG);
|
||||
Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)', LOGGER_DEBUG);
|
||||
$last_update = $result['last_update'];
|
||||
return $result['feed'];
|
||||
}
|
||||
|
@ -2212,7 +2213,7 @@ class OStatus
|
|||
$msg = ['feed' => $feeddata, 'last_update' => $last_update];
|
||||
Cache::set($cachekey, $msg, Cache::QUARTER_HOUR);
|
||||
|
||||
logger('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, LOGGER_DEBUG);
|
||||
Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, LOGGER_DEBUG);
|
||||
|
||||
return $feeddata;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ use DOMXPath;
|
|||
use Exception;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -84,14 +85,14 @@ class PortableContact
|
|||
|
||||
$url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation') ;
|
||||
|
||||
logger('load: ' . $url, LOGGER_DEBUG);
|
||||
Logger::log('load: ' . $url, LOGGER_DEBUG);
|
||||
|
||||
$fetchresult = Network::fetchUrlFull($url);
|
||||
$s = $fetchresult->getBody();
|
||||
|
||||
logger('load: returns ' . $s, LOGGER_DATA);
|
||||
Logger::log('load: returns ' . $s, LOGGER_DATA);
|
||||
|
||||
logger('load: return code: ' . $fetchresult->getReturnCode(), LOGGER_DEBUG);
|
||||
Logger::log('load: return code: ' . $fetchresult->getReturnCode(), LOGGER_DEBUG);
|
||||
|
||||
if (($fetchresult->getReturnCode() > 299) || (! $s)) {
|
||||
return;
|
||||
|
@ -99,7 +100,7 @@ class PortableContact
|
|||
|
||||
$j = json_decode($s, true);
|
||||
|
||||
logger('load: json: ' . print_r($j, true), LOGGER_DATA);
|
||||
Logger::log('load: json: ' . print_r($j, true), LOGGER_DATA);
|
||||
|
||||
if (!isset($j['entry'])) {
|
||||
return;
|
||||
|
@ -199,10 +200,10 @@ class PortableContact
|
|||
|
||||
GContact::link($gcid, $uid, $cid, $zcid);
|
||||
} catch (Exception $e) {
|
||||
logger($e->getMessage(), LOGGER_DEBUG);
|
||||
Logger::log($e->getMessage(), LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
logger("load: loaded $total entries", LOGGER_DEBUG);
|
||||
Logger::log("load: loaded $total entries", LOGGER_DEBUG);
|
||||
|
||||
$condition = ["`cid` = ? AND `uid` = ? AND `zcid` = ? AND `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY", $cid, $uid, $zcid];
|
||||
DBA::delete('glink', $condition);
|
||||
|
@ -335,7 +336,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (!in_array($gcontacts[0]["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::FEED, Protocol::OSTATUS, ""])) {
|
||||
logger("Profile ".$profile.": Network type ".$gcontacts[0]["network"]." can't be checked", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile.": Network type ".$gcontacts[0]["network"]." can't be checked", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -346,7 +347,7 @@ class PortableContact
|
|||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
}
|
||||
|
||||
logger("Profile ".$profile.": Server ".$server_url." wasn't reachable.", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile.": Server ".$server_url." wasn't reachable.", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
$contact['server_url'] = $server_url;
|
||||
|
@ -426,7 +427,7 @@ class PortableContact
|
|||
$fields = ['last_contact' => DateTimeFormat::utcNow()];
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", LOGGER_DEBUG);
|
||||
|
||||
return $noscrape["updated"];
|
||||
}
|
||||
|
@ -437,7 +438,7 @@ class PortableContact
|
|||
|
||||
// If we only can poll the feed, then we only do this once a while
|
||||
if (!$force && !self::updateNeeded($gcontacts[0]["created"], $gcontacts[0]["updated"], $gcontacts[0]["last_failure"], $gcontacts[0]["last_contact"])) {
|
||||
logger("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG);
|
||||
|
||||
GContact::update($contact);
|
||||
return $gcontacts[0]["updated"];
|
||||
|
@ -464,10 +465,10 @@ class PortableContact
|
|||
|
||||
self::lastUpdated($data["url"], $force);
|
||||
} catch (Exception $e) {
|
||||
logger($e->getMessage(), LOGGER_DEBUG);
|
||||
Logger::log($e->getMessage(), LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
logger("Profile ".$profile." was deleted", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." was deleted", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -475,7 +476,7 @@ class PortableContact
|
|||
$fields = ['last_failure' => DateTimeFormat::utcNow()];
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -491,7 +492,7 @@ class PortableContact
|
|||
$fields = ['last_failure' => DateTimeFormat::utcNow()];
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -539,7 +540,7 @@ class PortableContact
|
|||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
}
|
||||
|
||||
logger("Profile ".$profile." was last updated at ".$last_updated, LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." was last updated at ".$last_updated, LOGGER_DEBUG);
|
||||
|
||||
return $last_updated;
|
||||
}
|
||||
|
@ -662,7 +663,7 @@ class PortableContact
|
|||
|
||||
foreach ($nodeinfo['links'] as $link) {
|
||||
if (!is_array($link) || empty($link['rel'])) {
|
||||
logger('Invalid nodeinfo format for ' . $server_url, LOGGER_DEBUG);
|
||||
Logger::log('Invalid nodeinfo format for ' . $server_url, LOGGER_DEBUG);
|
||||
continue;
|
||||
}
|
||||
if ($link['rel'] == 'http://nodeinfo.diaspora.software/ns/schema/1.0') {
|
||||
|
@ -963,7 +964,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (!$force && !self::updateNeeded($gserver["created"], "", $last_failure, $last_contact)) {
|
||||
logger("Use cached data for server ".$server_url, LOGGER_DEBUG);
|
||||
Logger::log("Use cached data for server ".$server_url, LOGGER_DEBUG);
|
||||
return ($last_contact >= $last_failure);
|
||||
}
|
||||
} else {
|
||||
|
@ -979,7 +980,7 @@ class PortableContact
|
|||
$last_contact = DBA::NULL_DATETIME;
|
||||
$last_failure = DBA::NULL_DATETIME;
|
||||
}
|
||||
logger("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$gserver["created"]." Failure: ".$last_failure." Contact: ".$last_contact, LOGGER_DEBUG);
|
||||
Logger::log("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$gserver["created"]." Failure: ".$last_failure." Contact: ".$last_contact, LOGGER_DEBUG);
|
||||
|
||||
$failure = false;
|
||||
$possible_failure = false;
|
||||
|
@ -1004,7 +1005,7 @@ class PortableContact
|
|||
// But we want to make sure to only quit if we are mostly sure that this server url fits.
|
||||
if (DBA::isResult($gserver) && ($orig_server_url == $server_url) &&
|
||||
($curlResult->isTimeout())) {
|
||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
Logger::log("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
@ -1019,7 +1020,7 @@ class PortableContact
|
|||
|
||||
// Quit if there is a timeout
|
||||
if ($curlResult->isTimeout()) {
|
||||
logger("Connection to server " . $server_url . " timed out.", LOGGER_DEBUG);
|
||||
Logger::log("Connection to server " . $server_url . " timed out.", LOGGER_DEBUG);
|
||||
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
@ -1398,9 +1399,9 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (($last_contact <= $last_failure) && !$failure) {
|
||||
logger("Server ".$server_url." seems to be alive, but last contact wasn't set - could be a bug", LOGGER_DEBUG);
|
||||
Logger::log("Server ".$server_url." seems to be alive, but last contact wasn't set - could be a bug", LOGGER_DEBUG);
|
||||
} elseif (($last_contact >= $last_failure) && $failure) {
|
||||
logger("Server ".$server_url." seems to be dead, but last failure wasn't set - could be a bug", LOGGER_DEBUG);
|
||||
Logger::log("Server ".$server_url." seems to be dead, but last failure wasn't set - could be a bug", LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
// Check again if the server exists
|
||||
|
@ -1429,7 +1430,7 @@ class PortableContact
|
|||
self::discoverRelay($server_url);
|
||||
}
|
||||
|
||||
logger("End discovery for server " . $server_url, LOGGER_DEBUG);
|
||||
Logger::log("End discovery for server " . $server_url, LOGGER_DEBUG);
|
||||
|
||||
return !$failure;
|
||||
}
|
||||
|
@ -1441,7 +1442,7 @@ class PortableContact
|
|||
*/
|
||||
private static function discoverRelay($server_url)
|
||||
{
|
||||
logger("Discover relay data for server " . $server_url, LOGGER_DEBUG);
|
||||
Logger::log("Discover relay data for server " . $server_url, LOGGER_DEBUG);
|
||||
|
||||
$curlResult = Network::curl($server_url . "/.well-known/x-social-relay");
|
||||
|
||||
|
@ -1557,7 +1558,7 @@ class PortableContact
|
|||
$r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", DBA::escape(normalise_link($server_url)));
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
logger("Call server check for server ".$server_url, LOGGER_DEBUG);
|
||||
Logger::log("Call server check for server ".$server_url, LOGGER_DEBUG);
|
||||
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server_url);
|
||||
}
|
||||
}
|
||||
|
@ -1642,7 +1643,7 @@ class PortableContact
|
|||
// Fetch all users from the other server
|
||||
$url = $server["poco"] . "/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation";
|
||||
|
||||
logger("Fetch all users from the server " . $server["url"], LOGGER_DEBUG);
|
||||
Logger::log("Fetch all users from the server " . $server["url"], LOGGER_DEBUG);
|
||||
|
||||
$curlResult = Network::curl($url);
|
||||
|
||||
|
@ -1670,7 +1671,7 @@ class PortableContact
|
|||
$curlResult = Network::curl($url);
|
||||
|
||||
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
|
||||
logger("Fetch all global contacts from the server " . $server["nurl"], LOGGER_DEBUG);
|
||||
Logger::log("Fetch all global contacts from the server " . $server["nurl"], LOGGER_DEBUG);
|
||||
$data = json_decode($curlResult->getBody(), true);
|
||||
|
||||
if (!empty($data)) {
|
||||
|
@ -1679,7 +1680,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (!$success && (Config::get('system', 'poco_discovery') > 2)) {
|
||||
logger("Fetch contacts from users of the server " . $server["nurl"], LOGGER_DEBUG);
|
||||
Logger::log("Fetch contacts from users of the server " . $server["nurl"], LOGGER_DEBUG);
|
||||
self::discoverServerUsers($data, $server);
|
||||
}
|
||||
}
|
||||
|
@ -1732,7 +1733,7 @@ class PortableContact
|
|||
continue;
|
||||
}
|
||||
|
||||
logger('Update directory from server ' . $gserver['url'] . ' with ID ' . $gserver['id'], LOGGER_DEBUG);
|
||||
Logger::log('Update directory from server ' . $gserver['url'] . ' with ID ' . $gserver['id'], LOGGER_DEBUG);
|
||||
Worker::add(PRIORITY_LOW, 'DiscoverPoCo', 'update_server_directory', (int) $gserver['id']);
|
||||
|
||||
if (!$complete && ( --$no_of_queries == 0)) {
|
||||
|
@ -1762,7 +1763,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if ($username != '') {
|
||||
logger('Fetch contacts for the user ' . $username . ' from the server ' . $server['nurl'], LOGGER_DEBUG);
|
||||
Logger::log('Fetch contacts for the user ' . $username . ' from the server ' . $server['nurl'], LOGGER_DEBUG);
|
||||
|
||||
// Fetch all contacts from a given user from the other server
|
||||
$url = $server['poco'] . '/' . $username . '/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation';
|
||||
|
@ -1865,7 +1866,7 @@ class PortableContact
|
|||
if ($generation > 0) {
|
||||
$success = true;
|
||||
|
||||
logger("Store profile ".$profile_url, LOGGER_DEBUG);
|
||||
Logger::log("Store profile ".$profile_url, LOGGER_DEBUG);
|
||||
|
||||
$gcontact = ["url" => $profile_url,
|
||||
"name" => $name,
|
||||
|
@ -1884,10 +1885,10 @@ class PortableContact
|
|||
$gcontact = GContact::sanitize($gcontact);
|
||||
GContact::update($gcontact);
|
||||
} catch (Exception $e) {
|
||||
logger($e->getMessage(), LOGGER_DEBUG);
|
||||
Logger::log($e->getMessage(), LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
logger("Done for profile ".$profile_url, LOGGER_DEBUG);
|
||||
Logger::log("Done for profile ".$profile_url, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
return $success;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
namespace Friendica\Protocol;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -25,7 +26,7 @@ class Salmon
|
|||
{
|
||||
$ret = [];
|
||||
|
||||
logger('Fetching salmon key for '.$uri);
|
||||
Logger::log('Fetching salmon key for '.$uri);
|
||||
|
||||
$arr = Probe::lrdd($uri);
|
||||
|
||||
|
@ -57,7 +58,7 @@ class Salmon
|
|||
}
|
||||
|
||||
|
||||
logger('Key located: ' . print_r($ret, true));
|
||||
Logger::log('Key located: ' . print_r($ret, true));
|
||||
|
||||
if (count($ret) == 1) {
|
||||
// We only found one one key so we don't care if the hash matches.
|
||||
|
@ -94,12 +95,12 @@ class Salmon
|
|||
}
|
||||
|
||||
if (! $owner['sprvkey']) {
|
||||
logger(sprintf("user '%s' (%d) does not have a salmon private key. Send failed.",
|
||||
Logger::log(sprintf("user '%s' (%d) does not have a salmon private key. Send failed.",
|
||||
$owner['username'], $owner['uid']));
|
||||
return;
|
||||
}
|
||||
|
||||
logger('slapper called for '.$url.'. Data: ' . $slap);
|
||||
Logger::log('slapper called for '.$url.'. Data: ' . $slap);
|
||||
|
||||
// create a magic envelope
|
||||
|
||||
|
@ -143,7 +144,7 @@ class Salmon
|
|||
// check for success, e.g. 2xx
|
||||
|
||||
if ($return_code > 299) {
|
||||
logger('GNU Social salmon failed. Falling back to compliant mode');
|
||||
Logger::log('GNU Social salmon failed. Falling back to compliant mode');
|
||||
|
||||
// Now try the compliant mode that normally isn't used for GNU Social
|
||||
$xmldata = ["me:env" => ["me:data" => $data,
|
||||
|
@ -166,7 +167,7 @@ class Salmon
|
|||
}
|
||||
|
||||
if ($return_code > 299) {
|
||||
logger('compliant salmon failed. Falling back to old status.net');
|
||||
Logger::log('compliant salmon failed. Falling back to old status.net');
|
||||
|
||||
// Last try. This will most likely fail as well.
|
||||
$xmldata = ["me:env" => ["me:data" => $data,
|
||||
|
@ -187,7 +188,7 @@ class Salmon
|
|||
$return_code = $postResult->getReturnCode();
|
||||
}
|
||||
|
||||
logger('slapper for '.$url.' returned ' . $return_code);
|
||||
Logger::log('slapper for '.$url.' returned ' . $return_code);
|
||||
|
||||
if (! $return_code) {
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue