mirror of
https://github.com/friendica/friendica
synced 2025-04-28 21:44:22 +02:00
Logger Levels
update logger levels in calls
This commit is contained in:
parent
91ef9f238c
commit
50da89d861
86 changed files with 673 additions and 673 deletions
|
@ -159,7 +159,7 @@ class Processor
|
|||
{
|
||||
$owner = Contact::getIdForURL($activity['actor']);
|
||||
|
||||
Logger::log('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]);
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ class Processor
|
|||
}
|
||||
|
||||
$event_id = Event::store($event);
|
||||
Logger::log('Event '.$event_id.' was stored', LOGGER_DEBUG);
|
||||
Logger::log('Event '.$event_id.' was stored', Logger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,7 +226,7 @@ class Processor
|
|||
/// @todo What to do with $activity['context']?
|
||||
|
||||
if (($item['gravity'] != GRAVITY_PARENT) && !Item::exists(['uri' => $item['parent-uri']])) {
|
||||
Logger::log('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;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ class Processor
|
|||
$item['owner-link'] = $activity['actor'];
|
||||
$item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true);
|
||||
} else {
|
||||
Logger::log('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'];
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ class Processor
|
|||
return;
|
||||
}
|
||||
|
||||
Logger::log('Updating profile for ' . $activity['object_id'], LOGGER_DEBUG);
|
||||
Logger::log('Updating profile for ' . $activity['object_id'], Logger::DEBUG);
|
||||
APContact::getByURL($activity['object_id'], true);
|
||||
}
|
||||
|
||||
|
@ -387,12 +387,12 @@ class Processor
|
|||
public static function deletePerson($activity)
|
||||
{
|
||||
if (empty($activity['object_id']) || empty($activity['actor'])) {
|
||||
Logger::log('Empty object id or actor.', LOGGER_DEBUG);
|
||||
Logger::log('Empty object id or actor.', Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($activity['object_id'] != $activity['actor']) {
|
||||
Logger::log('Object id does not match actor.', LOGGER_DEBUG);
|
||||
Logger::log('Object id does not match actor.', Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ class Processor
|
|||
}
|
||||
DBA::close($contacts);
|
||||
|
||||
Logger::log('Deleted contact ' . $activity['object_id'], LOGGER_DEBUG);
|
||||
Logger::log('Deleted contact ' . $activity['object_id'], Logger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -421,7 +421,7 @@ class Processor
|
|||
|
||||
$cid = Contact::getIdForURL($activity['actor'], $uid);
|
||||
if (empty($cid)) {
|
||||
Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
|
||||
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ class Processor
|
|||
|
||||
$condition = ['id' => $cid];
|
||||
DBA::update('contact', $fields, $condition);
|
||||
Logger::log('Accept contact request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG);
|
||||
Logger::log('Accept contact request from contact ' . $cid . ' for user ' . $uid, Logger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -455,7 +455,7 @@ class Processor
|
|||
|
||||
$cid = Contact::getIdForURL($activity['actor'], $uid);
|
||||
if (empty($cid)) {
|
||||
Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
|
||||
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -463,9 +463,9 @@ class Processor
|
|||
|
||||
if (DBA::exists('contact', ['id' => $cid, 'rel' => Contact::SHARING, 'pending' => true])) {
|
||||
Contact::remove($cid);
|
||||
Logger::log('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::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . '.', LOGGER_DEBUG);
|
||||
Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . '.', Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ class Processor
|
|||
|
||||
$cid = Contact::getIdForURL($activity['actor'], $uid);
|
||||
if (empty($cid)) {
|
||||
Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
|
||||
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ class Processor
|
|||
}
|
||||
|
||||
Contact::removeFollower($owner, $contact);
|
||||
Logger::log('Undo following request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG);
|
||||
Logger::log('Undo following request from contact ' . $cid . ' for user ' . $uid, Logger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,16 +60,16 @@ class Receiver
|
|||
{
|
||||
$http_signer = HTTPSignature::getSigner($body, $header);
|
||||
if (empty($http_signer)) {
|
||||
Logger::log('Invalid HTTP signature, message will be discarded.', LOGGER_DEBUG);
|
||||
Logger::log('Invalid HTTP signature, message will be discarded.', Logger::DEBUG);
|
||||
return;
|
||||
} else {
|
||||
Logger::log('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::log('Invalid body.', LOGGER_DEBUG);
|
||||
Logger::log('Invalid body.', Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -77,31 +77,31 @@ class Receiver
|
|||
|
||||
$actor = JsonLD::fetchElement($ldactivity, 'as:actor');
|
||||
|
||||
Logger::log('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::log('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::log('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::log('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::log('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::log('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::log('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::log('No JSON-LD signature, different actor.', LOGGER_DEBUG);
|
||||
Logger::log('No JSON-LD signature, different actor.', Logger::DEBUG);
|
||||
$trust_source = false;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ class Receiver
|
|||
{
|
||||
$actor = JsonLD::fetchElement($activity, 'as:actor');
|
||||
if (empty($actor)) {
|
||||
Logger::log('Empty actor', LOGGER_DEBUG);
|
||||
Logger::log('Empty actor', Logger::DEBUG);
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -176,11 +176,11 @@ class Receiver
|
|||
$receivers = array_merge($receivers, $additional);
|
||||
}
|
||||
|
||||
Logger::log('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::log('No object found', LOGGER_DEBUG);
|
||||
Logger::log('No object found', Logger::DEBUG);
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ class Receiver
|
|||
}
|
||||
$object_data = self::fetchObject($object_id, $activity['as:object'], $trust_source);
|
||||
if (empty($object_data)) {
|
||||
Logger::log("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
|
||||
|
@ -230,7 +230,7 @@ class Receiver
|
|||
$object_data['actor'] = $actor;
|
||||
$object_data['receiver'] = array_merge(defaults($object_data, 'receiver', []), $receivers);
|
||||
|
||||
Logger::log('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;
|
||||
}
|
||||
|
@ -273,17 +273,17 @@ class Receiver
|
|||
{
|
||||
$type = JsonLD::fetchElement($activity, '@type');
|
||||
if (!$type) {
|
||||
Logger::log('Empty type', LOGGER_DEBUG);
|
||||
Logger::log('Empty type', Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!JsonLD::fetchElement($activity, 'as:object')) {
|
||||
Logger::log('Empty object', LOGGER_DEBUG);
|
||||
Logger::log('Empty object', Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!JsonLD::fetchElement($activity, 'as:actor')) {
|
||||
Logger::log('Empty actor', LOGGER_DEBUG);
|
||||
Logger::log('Empty actor', Logger::DEBUG);
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -291,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::log('No object data found', LOGGER_DEBUG);
|
||||
Logger::log('No object data found', Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$trust_source) {
|
||||
Logger::log('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;
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ class Receiver
|
|||
break;
|
||||
|
||||
default:
|
||||
Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], LOGGER_DEBUG);
|
||||
Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], Logger::DEBUG);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -415,9 +415,9 @@ class Receiver
|
|||
$profile = APContact::getByURL($actor);
|
||||
$followers = defaults($profile, 'followers', '');
|
||||
|
||||
Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG);
|
||||
Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, Logger::DEBUG);
|
||||
} else {
|
||||
Logger::log('Empty actor', LOGGER_DEBUG);
|
||||
Logger::log('Empty actor', Logger::DEBUG);
|
||||
$followers = '';
|
||||
}
|
||||
|
||||
|
@ -501,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::log('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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -571,27 +571,27 @@ class Receiver
|
|||
$data = ActivityPub::fetchContent($object_id);
|
||||
if (!empty($data)) {
|
||||
$object = JsonLD::compact($data);
|
||||
Logger::log('Fetched content for ' . $object_id, LOGGER_DEBUG);
|
||||
Logger::log('Fetched content for ' . $object_id, Logger::DEBUG);
|
||||
} else {
|
||||
Logger::log('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::log('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::log('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::log('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::log('Empty type', LOGGER_DEBUG);
|
||||
Logger::log('Empty type', Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -607,7 +607,7 @@ class Receiver
|
|||
return self::fetchObject($object_id);
|
||||
}
|
||||
|
||||
Logger::log('Unhandled object type: ' . $type, LOGGER_DEBUG);
|
||||
Logger::log('Unhandled object type: ' . $type, Logger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1016,7 +1016,7 @@ class Transmitter
|
|||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
|
||||
Logger::log('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);
|
||||
}
|
||||
|
||||
|
@ -1045,7 +1045,7 @@ class Transmitter
|
|||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
|
||||
Logger::log('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);
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ class Transmitter
|
|||
|
||||
$signed = LDSignature::sign($data, $owner);
|
||||
|
||||
Logger::log('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);
|
||||
}
|
||||
|
||||
|
@ -1099,7 +1099,7 @@ class Transmitter
|
|||
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
|
||||
'to' => $profile['url']];
|
||||
|
||||
Logger::log('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);
|
||||
|
@ -1127,7 +1127,7 @@ class Transmitter
|
|||
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
|
||||
'to' => $profile['url']];
|
||||
|
||||
Logger::log('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);
|
||||
|
@ -1155,7 +1155,7 @@ class Transmitter
|
|||
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
|
||||
'to' => $profile['url']];
|
||||
|
||||
Logger::log('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);
|
||||
|
@ -1184,7 +1184,7 @@ class Transmitter
|
|||
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
|
||||
'to' => $profile['url']];
|
||||
|
||||
Logger::log('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);
|
||||
|
|
|
@ -176,7 +176,7 @@ class DFRN
|
|||
);
|
||||
|
||||
if (! DBA::isResult($r)) {
|
||||
Logger::log(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();
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ class DFRN
|
|||
);
|
||||
|
||||
if (! DBA::isResult($r)) {
|
||||
Logger::log(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();
|
||||
}
|
||||
|
||||
|
@ -1189,7 +1189,7 @@ class DFRN
|
|||
$rino = Config::get('system', 'rino_encrypt');
|
||||
$rino = intval($rino);
|
||||
|
||||
Logger::log("Local rino version: ". $rino, LOGGER_DEBUG);
|
||||
Logger::log("Local rino version: ". $rino, Logger::DEBUG);
|
||||
|
||||
$ssl_val = intval(Config::get('system', 'ssl_policy'));
|
||||
$ssl_policy = '';
|
||||
|
@ -1226,7 +1226,7 @@ class DFRN
|
|||
return -3; // timed out
|
||||
}
|
||||
|
||||
Logger::log('dfrn_deliver: ' . $xml, LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: ' . $xml, Logger::DATA);
|
||||
|
||||
if (empty($xml)) {
|
||||
Contact::markForArchival($contact);
|
||||
|
@ -1235,7 +1235,7 @@ class DFRN
|
|||
|
||||
if (strpos($xml, '<?xml') === false) {
|
||||
Logger::log('dfrn_deliver: no valid XML returned');
|
||||
Logger::log('dfrn_deliver: returned XML: ' . $xml, LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: returned XML: ' . $xml, Logger::DATA);
|
||||
Contact::markForArchival($contact);
|
||||
return 3;
|
||||
}
|
||||
|
@ -1262,7 +1262,7 @@ class DFRN
|
|||
$rino_remote_version = intval($res->rino);
|
||||
$page = (($owner['page-flags'] == Contact::PAGE_COMMUNITY) ? 1 : 0);
|
||||
|
||||
Logger::log("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;
|
||||
|
@ -1366,13 +1366,13 @@ class DFRN
|
|||
}
|
||||
|
||||
|
||||
Logger::log('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::log('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: ' . "RECEIVED: " . $xml, Logger::DATA);
|
||||
|
||||
$curl_stat = $postResult->getReturnCode();
|
||||
if (empty($curl_stat) || empty($xml)) {
|
||||
|
@ -1387,7 +1387,7 @@ class DFRN
|
|||
|
||||
if (strpos($xml, '<?xml') === false) {
|
||||
Logger::log('dfrn_deliver: phase 2: no valid XML returned');
|
||||
Logger::log('dfrn_deliver: phase 2: returned XML: ' . $xml, LOGGER_DATA);
|
||||
Logger::log('dfrn_deliver: phase 2: returned XML: ' . $xml, Logger::DATA);
|
||||
Contact::markForArchival($contact);
|
||||
return 3;
|
||||
}
|
||||
|
@ -1405,7 +1405,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if (!empty($res->message)) {
|
||||
Logger::log('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)) {
|
||||
|
@ -1486,7 +1486,7 @@ class DFRN
|
|||
|
||||
if (strpos($xml, '<?xml') === false) {
|
||||
Logger::log('No valid XML returned from ' . $contact['id'] . ' - ' . $dest_url);
|
||||
Logger::log('Returned XML: ' . $xml, LOGGER_DATA);
|
||||
Logger::log('Returned XML: ' . $xml, Logger::DATA);
|
||||
Contact::markForArchival($contact);
|
||||
return 3;
|
||||
}
|
||||
|
@ -1499,7 +1499,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if (!empty($res->message)) {
|
||||
Logger::log('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)) {
|
||||
|
@ -1576,7 +1576,7 @@ class DFRN
|
|||
$author["network"] = $contact_old["network"];
|
||||
} else {
|
||||
if (!$onlyfetch) {
|
||||
Logger::log("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;
|
||||
|
@ -1629,7 +1629,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if (DBA::isResult($contact_old) && !$onlyfetch) {
|
||||
Logger::log("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"]];
|
||||
|
||||
|
@ -1690,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::log("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.
|
||||
|
@ -1762,20 +1762,20 @@ class DFRN
|
|||
$contact[$field] = DateTimeFormat::utc($contact[$field]);
|
||||
|
||||
if (strtotime($contact[$field]) > strtotime($contact_old[$field])) {
|
||||
Logger::log("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::log("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::log("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',
|
||||
|
@ -2299,7 +2299,7 @@ class DFRN
|
|||
*/
|
||||
private static function processVerbs($entrytype, $importer, &$item, &$is_like)
|
||||
{
|
||||
Logger::log("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
|
||||
|
@ -2464,7 +2464,7 @@ class DFRN
|
|||
);
|
||||
// Is there an existing item?
|
||||
if (DBA::isResult($current) && !self::isEditedTimestampNewer($current, $item)) {
|
||||
Logger::log("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG);
|
||||
Logger::log("Item ".$item["uri"]." (".$item['edited'].") already existed.", Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2672,10 +2672,10 @@ class DFRN
|
|||
|
||||
// Is it an event?
|
||||
if (($item["object-type"] == ACTIVITY_OBJ_EVENT) && !$owner_unknown) {
|
||||
Logger::log("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::log("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"];
|
||||
|
@ -2691,20 +2691,20 @@ class DFRN
|
|||
}
|
||||
|
||||
$event_id = Event::store($ev);
|
||||
Logger::log("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::log("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::log("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;
|
||||
}
|
||||
|
||||
|
@ -2712,9 +2712,9 @@ class DFRN
|
|||
// Update content if 'updated' changes
|
||||
if (DBA::isResult($current)) {
|
||||
if (self::updateContent($current, $item, $importer, $entrytype)) {
|
||||
Logger::log("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
|
||||
Logger::log("Item ".$item["uri"]." was updated.", Logger::DEBUG);
|
||||
} else {
|
||||
Logger::log("Item " . $item["uri"] . " already existed.", LOGGER_DEBUG);
|
||||
Logger::log("Item " . $item["uri"] . " already existed.", Logger::DEBUG);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2724,7 +2724,7 @@ class DFRN
|
|||
$parent = 0;
|
||||
|
||||
if ($posted_id) {
|
||||
Logger::log("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);
|
||||
|
@ -2734,7 +2734,7 @@ class DFRN
|
|||
}
|
||||
} else { // $entrytype == DFRN::TOP_LEVEL
|
||||
if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) {
|
||||
Logger::log("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"])) {
|
||||
|
@ -2744,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::log('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::log("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;
|
||||
}
|
||||
|
||||
|
@ -2764,7 +2764,7 @@ class DFRN
|
|||
$posted_id = $notify;
|
||||
}
|
||||
|
||||
Logger::log("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);
|
||||
|
@ -2803,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::log("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::log("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::log("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;
|
||||
}
|
||||
|
||||
|
@ -2822,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::log("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;
|
||||
}
|
||||
}
|
||||
|
@ -2831,7 +2831,7 @@ class DFRN
|
|||
return;
|
||||
}
|
||||
|
||||
Logger::log('deleting item '.$item['id'].' uri='.$uri, LOGGER_DEBUG);
|
||||
Logger::log('deleting item '.$item['id'].' uri='.$uri, Logger::DEBUG);
|
||||
|
||||
Item::delete(['id' => $item['id']]);
|
||||
}
|
||||
|
@ -2885,7 +2885,7 @@ class DFRN
|
|||
self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml);
|
||||
}
|
||||
|
||||
Logger::log("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()"));
|
||||
|
@ -2951,7 +2951,7 @@ class DFRN
|
|||
self::processEntry($header, $xpath, $entry, $importer, $xml);
|
||||
}
|
||||
}
|
||||
Logger::log("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;
|
||||
}
|
||||
|
||||
|
@ -3036,7 +3036,7 @@ class DFRN
|
|||
|
||||
$url = curPageURL();
|
||||
|
||||
Logger::log('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);
|
||||
|
|
|
@ -261,7 +261,7 @@ class Diaspora
|
|||
|
||||
if (base64_encode(base64_decode(base64_decode($signature))) == base64_decode($signature)) {
|
||||
$signature = base64_decode($signature);
|
||||
Logger::log("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, LOGGER_DEBUG);
|
||||
Logger::log("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, Logger::DEBUG);
|
||||
|
||||
// Do a recursive call to be able to fix even multiple levels
|
||||
if ($level < 10) {
|
||||
|
@ -498,7 +498,7 @@ class Diaspora
|
|||
} else {
|
||||
// This happens with posts from a relais
|
||||
if (!$importer) {
|
||||
Logger::log("This is no private post in the old format", LOGGER_DEBUG);
|
||||
Logger::log("This is no private post in the old format", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -517,7 +517,7 @@ class Diaspora
|
|||
|
||||
$decrypted = self::aesDecrypt($outer_key, $outer_iv, $ciphertext);
|
||||
|
||||
Logger::log('decrypted: '.$decrypted, LOGGER_DEBUG);
|
||||
Logger::log('decrypted: '.$decrypted, Logger::DEBUG);
|
||||
$idom = XML::parseString($decrypted);
|
||||
|
||||
$inner_iv = base64_decode($idom->iv);
|
||||
|
@ -662,7 +662,7 @@ class Diaspora
|
|||
|
||||
$type = $fields->getName();
|
||||
|
||||
Logger::log("Received message type ".$type." from ".$sender." for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Received message type ".$type." from ".$sender." for user ".$importer["uid"], Logger::DEBUG);
|
||||
|
||||
switch ($type) {
|
||||
case "account_migration":
|
||||
|
@ -754,7 +754,7 @@ class Diaspora
|
|||
$data = XML::parseString($msg["message"]);
|
||||
|
||||
if (!is_object($data)) {
|
||||
Logger::log("No valid XML ".$msg["message"], LOGGER_DEBUG);
|
||||
Logger::log("No valid XML ".$msg["message"], Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -772,7 +772,7 @@ class Diaspora
|
|||
$type = $element->getName();
|
||||
$orig_type = $type;
|
||||
|
||||
Logger::log("Got message type ".$type.": ".$msg["message"], LOGGER_DATA);
|
||||
Logger::log("Got message type ".$type.": ".$msg["message"], Logger::DATA);
|
||||
|
||||
// All retractions are handled identically from now on.
|
||||
// In the new version there will only be "retraction".
|
||||
|
@ -859,31 +859,31 @@ class Diaspora
|
|||
}
|
||||
// No author_signature? This is a must, so we quit.
|
||||
if (!isset($author_signature)) {
|
||||
Logger::log("No author signature for type ".$type." - Message: ".$msg["message"], LOGGER_DEBUG);
|
||||
Logger::log("No author signature for type ".$type." - Message: ".$msg["message"], Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($parent_author_signature)) {
|
||||
$key = self::key($msg["author"]);
|
||||
if (empty($key)) {
|
||||
Logger::log("No key found for parent author ".$msg["author"], LOGGER_DEBUG);
|
||||
Logger::log("No key found for parent author ".$msg["author"], Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Crypto::rsaVerify($signed_data, $parent_author_signature, $key, "sha256")) {
|
||||
Logger::log("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, LOGGER_DEBUG);
|
||||
Logger::log("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$key = self::key($fields->author);
|
||||
if (empty($key)) {
|
||||
Logger::log("No key found for author ".$fields->author, LOGGER_DEBUG);
|
||||
Logger::log("No key found for author ".$fields->author, Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Crypto::rsaVerify($signed_data, $author_signature, $key, "sha256")) {
|
||||
Logger::log("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, LOGGER_DEBUG);
|
||||
Logger::log("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, Logger::DEBUG);
|
||||
return false;
|
||||
} else {
|
||||
return $fields;
|
||||
|
@ -924,7 +924,7 @@ class Diaspora
|
|||
|
||||
$person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
|
||||
if (DBA::isResult($person)) {
|
||||
Logger::log("In cache " . print_r($person, true), LOGGER_DEBUG);
|
||||
Logger::log("In cache " . print_r($person, true), Logger::DEBUG);
|
||||
|
||||
// update record occasionally so it doesn't get stale
|
||||
$d = strtotime($person["updated"]." +00:00");
|
||||
|
@ -938,7 +938,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if (!DBA::isResult($person) || $update) {
|
||||
Logger::log("create or refresh", LOGGER_DEBUG);
|
||||
Logger::log("create or refresh", Logger::DEBUG);
|
||||
$r = Probe::uri($handle, Protocol::DIASPORA);
|
||||
|
||||
// Note that Friendica contacts will return a "Diaspora person"
|
||||
|
@ -990,7 +990,7 @@ class Diaspora
|
|||
{
|
||||
$handle = false;
|
||||
|
||||
Logger::log("contact id is ".$contact_id." - pcontact id is ".$pcontact_id, LOGGER_DEBUG);
|
||||
Logger::log("contact id is ".$contact_id." - pcontact id is ".$pcontact_id, Logger::DEBUG);
|
||||
|
||||
if ($pcontact_id != 0) {
|
||||
$contact = DBA::selectFirst('contact', ['addr'], ['id' => $pcontact_id]);
|
||||
|
@ -1008,7 +1008,7 @@ class Diaspora
|
|||
if (DBA::isResult($r)) {
|
||||
$contact = $r[0];
|
||||
|
||||
Logger::log("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG);
|
||||
Logger::log("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], Logger::DEBUG);
|
||||
|
||||
if ($contact['addr'] != "") {
|
||||
$handle = $contact['addr'];
|
||||
|
@ -1034,7 +1034,7 @@ class Diaspora
|
|||
*/
|
||||
public static function urlFromContactGuid($fcontact_guid)
|
||||
{
|
||||
Logger::log("fcontact guid is ".$fcontact_guid, LOGGER_DEBUG);
|
||||
Logger::log("fcontact guid is ".$fcontact_guid, Logger::DEBUG);
|
||||
|
||||
$r = q(
|
||||
"SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'",
|
||||
|
@ -1069,14 +1069,14 @@ class Diaspora
|
|||
}
|
||||
|
||||
if (!$cid) {
|
||||
Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
|
||||
Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $cid]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
// This here shouldn't happen at all
|
||||
Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
|
||||
Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1278,7 +1278,7 @@ class Diaspora
|
|||
|
||||
$server = $serverparts["scheme"]."://".$serverparts["host"];
|
||||
|
||||
Logger::log("Trying to fetch item ".$guid." from ".$server, LOGGER_DEBUG);
|
||||
Logger::log("Trying to fetch item ".$guid." from ".$server, Logger::DEBUG);
|
||||
|
||||
$msg = self::message($guid, $server);
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ class Diaspora
|
|||
return false;
|
||||
}
|
||||
|
||||
Logger::log("Successfully fetched item ".$guid." from ".$server, LOGGER_DEBUG);
|
||||
Logger::log("Successfully fetched item ".$guid." from ".$server, Logger::DEBUG);
|
||||
|
||||
// Now call the dispatcher
|
||||
return self::dispatchPublic($msg);
|
||||
|
@ -1313,16 +1313,16 @@ class Diaspora
|
|||
// This will work for new Diaspora servers and Friendica servers from 3.5
|
||||
$source_url = $server."/fetch/post/".urlencode($guid);
|
||||
|
||||
Logger::log("Fetch post from ".$source_url, LOGGER_DEBUG);
|
||||
Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
|
||||
|
||||
$envelope = Network::fetchUrl($source_url);
|
||||
if ($envelope) {
|
||||
Logger::log("Envelope was fetched.", LOGGER_DEBUG);
|
||||
Logger::log("Envelope was fetched.", Logger::DEBUG);
|
||||
$x = self::verifyMagicEnvelope($envelope);
|
||||
if (!$x) {
|
||||
Logger::log("Envelope could not be verified.", LOGGER_DEBUG);
|
||||
Logger::log("Envelope could not be verified.", Logger::DEBUG);
|
||||
} else {
|
||||
Logger::log("Envelope was verified.", LOGGER_DEBUG);
|
||||
Logger::log("Envelope was verified.", Logger::DEBUG);
|
||||
}
|
||||
} else {
|
||||
$x = false;
|
||||
|
@ -1331,7 +1331,7 @@ class Diaspora
|
|||
// This will work for older Diaspora and Friendica servers
|
||||
if (!$x) {
|
||||
$source_url = $server."/p/".urlencode($guid).".xml";
|
||||
Logger::log("Fetch post from ".$source_url, LOGGER_DEBUG);
|
||||
Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
|
||||
|
||||
$x = Network::fetchUrl($source_url);
|
||||
if (!$x) {
|
||||
|
@ -1347,11 +1347,11 @@ class Diaspora
|
|||
|
||||
if ($source_xml->post->reshare) {
|
||||
// Reshare of a reshare - old Diaspora version
|
||||
Logger::log("Message is a reshare", LOGGER_DEBUG);
|
||||
Logger::log("Message is a reshare", Logger::DEBUG);
|
||||
return self::message($source_xml->post->reshare->root_guid, $server, ++$level);
|
||||
} elseif ($source_xml->getName() == "reshare") {
|
||||
// Reshare of a reshare - new Diaspora version
|
||||
Logger::log("Message is a new reshare", LOGGER_DEBUG);
|
||||
Logger::log("Message is a new reshare", Logger::DEBUG);
|
||||
return self::message($source_xml->root_guid, $server, ++$level);
|
||||
}
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ class Diaspora
|
|||
|
||||
// If this isn't a "status_message" then quit
|
||||
if (!$author) {
|
||||
Logger::log("Message doesn't seem to be a status message", LOGGER_DEBUG);
|
||||
Logger::log("Message doesn't seem to be a status message", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1405,7 +1405,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($result) {
|
||||
Logger::log("Fetched missing item ".$guid." - result: ".$result, LOGGER_DEBUG);
|
||||
Logger::log("Fetched missing item ".$guid." - result: ".$result, Logger::DEBUG);
|
||||
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
}
|
||||
|
@ -1635,7 +1635,7 @@ class Diaspora
|
|||
{
|
||||
$item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]);
|
||||
if (DBA::isResult($item)) {
|
||||
Logger::log("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
|
||||
Logger::log("Found user ".$item['uid']." as owner of item ".$guid, Logger::DEBUG);
|
||||
$contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
|
||||
if (DBA::isResult($contact)) {
|
||||
return $contact;
|
||||
|
@ -1750,7 +1750,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($message_id) {
|
||||
Logger::log("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
Logger::log("Stored comment ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id, json_encode($data));
|
||||
}
|
||||
|
@ -1805,7 +1805,7 @@ class Diaspora
|
|||
DBA::lock('mail');
|
||||
|
||||
if (DBA::exists('mail', ['guid' => $msg_guid, 'uid' => $importer["uid"]])) {
|
||||
Logger::log("duplicate message already delivered.", LOGGER_DEBUG);
|
||||
Logger::log("duplicate message already delivered.", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2009,7 +2009,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($message_id) {
|
||||
Logger::log("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
Logger::log("Stored like ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id, json_encode($data));
|
||||
}
|
||||
|
@ -2064,7 +2064,7 @@ class Diaspora
|
|||
DBA::lock('mail');
|
||||
|
||||
if (DBA::exists('mail', ['guid' => $guid, 'uid' => $importer["uid"]])) {
|
||||
Logger::log("duplicate message already delivered.", LOGGER_DEBUG);
|
||||
Logger::log("duplicate message already delivered.", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2132,7 +2132,7 @@ class Diaspora
|
|||
$server = $author;
|
||||
}
|
||||
|
||||
Logger::log('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG);
|
||||
Logger::log('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, Logger::DEBUG);
|
||||
|
||||
if (!DBA::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
|
||||
DBA::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
|
||||
|
@ -2149,7 +2149,7 @@ class Diaspora
|
|||
} else {
|
||||
$cmd = $comment['self'] ? 'like' : 'comment-import';
|
||||
}
|
||||
Logger::log("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, LOGGER_DEBUG);
|
||||
Logger::log("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, Logger::DEBUG);
|
||||
Worker::add(PRIORITY_HIGH, 'Delivery', $cmd, $comment['id'], $contact_id);
|
||||
}
|
||||
DBA::close($comments);
|
||||
|
@ -2275,7 +2275,7 @@ class Diaspora
|
|||
|
||||
GContact::link($gcid, $importer["uid"], $contact["id"]);
|
||||
|
||||
Logger::log("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], Logger::DEBUG);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2337,7 +2337,7 @@ class Diaspora
|
|||
// That makes us friends.
|
||||
if ($contact) {
|
||||
if ($following) {
|
||||
Logger::log("Author ".$author." (Contact ".$contact["id"].") wants to follow us.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." (Contact ".$contact["id"].") wants to follow us.", Logger::DEBUG);
|
||||
self::receiveRequestMakeFriend($importer, $contact);
|
||||
|
||||
// refetch the contact array
|
||||
|
@ -2348,30 +2348,30 @@ class Diaspora
|
|||
if (in_array($contact["rel"], [Contact::FRIEND])) {
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
|
||||
if (DBA::isResult($user)) {
|
||||
Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], Logger::DEBUG);
|
||||
$ret = self::sendShare($user, $contact);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
Logger::log("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." doesn't want to follow us anymore.", Logger::DEBUG);
|
||||
Contact::removeFollower($importer, $contact);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$following && $sharing && in_array($importer["page-flags"], [Contact::PAGE_SOAPBOX, Contact::PAGE_NORMAL])) {
|
||||
Logger::log("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", Logger::DEBUG);
|
||||
return false;
|
||||
} elseif (!$following && !$sharing) {
|
||||
Logger::log("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", Logger::DEBUG);
|
||||
return false;
|
||||
} elseif (!$following && $sharing) {
|
||||
Logger::log("Author ".$author." wants to share with us.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." wants to share with us.", Logger::DEBUG);
|
||||
} elseif ($following && $sharing) {
|
||||
Logger::log("Author ".$author." wants to have a bidirectional conection.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." wants to have a bidirectional conection.", Logger::DEBUG);
|
||||
} elseif ($following && !$sharing) {
|
||||
Logger::log("Author ".$author." wants to listen to us.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." wants to listen to us.", Logger::DEBUG);
|
||||
}
|
||||
|
||||
$ret = self::personByHandle($author);
|
||||
|
@ -2412,14 +2412,14 @@ class Diaspora
|
|||
return;
|
||||
}
|
||||
|
||||
Logger::log("Author ".$author." was added as contact number ".$contact_record["id"].".", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." was added as contact number ".$contact_record["id"].".", Logger::DEBUG);
|
||||
|
||||
Group::addMember(User::getDefaultGroup($importer['uid'], $ret["network"]), $contact_record['id']);
|
||||
|
||||
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
|
||||
|
||||
if (in_array($importer["page-flags"], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP])) {
|
||||
Logger::log("Sending intra message for author ".$author.".", LOGGER_DEBUG);
|
||||
Logger::log("Sending intra message for author ".$author.".", Logger::DEBUG);
|
||||
|
||||
$hash = random_string().(string)time(); // Generate a confirm_key
|
||||
|
||||
|
@ -2437,7 +2437,7 @@ class Diaspora
|
|||
} else {
|
||||
// automatic friend approval
|
||||
|
||||
Logger::log("Does an automatic friend approval for author ".$author.".", LOGGER_DEBUG);
|
||||
Logger::log("Does an automatic friend approval for author ".$author.".", Logger::DEBUG);
|
||||
|
||||
Contact::updateAvatar($contact_record["photo"], $importer["uid"], $contact_record["id"]);
|
||||
|
||||
|
@ -2471,7 +2471,7 @@ class Diaspora
|
|||
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
|
||||
if (DBA::isResult($user)) {
|
||||
Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], Logger::DEBUG);
|
||||
$ret = self::sendShare($user, $contact_record);
|
||||
|
||||
// Send the profile data, maybe it weren't transmitted before
|
||||
|
@ -2644,7 +2644,7 @@ class Diaspora
|
|||
self::sendParticipation($contact, $datarray);
|
||||
|
||||
if ($message_id) {
|
||||
Logger::log("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
Logger::log("Stored reshare ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id);
|
||||
}
|
||||
|
@ -2697,7 +2697,7 @@ class Diaspora
|
|||
|
||||
while ($item = Item::fetch($r)) {
|
||||
if (strstr($item['file'], '[')) {
|
||||
Logger::log("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.", LOGGER_DEBUG);
|
||||
Logger::log("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.", Logger::DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2706,13 +2706,13 @@ class Diaspora
|
|||
|
||||
// Only delete it if the parent author really fits
|
||||
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
|
||||
Logger::log("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], LOGGER_DEBUG);
|
||||
Logger::log("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], Logger::DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
Item::delete(['id' => $item['id']]);
|
||||
|
||||
Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG);
|
||||
Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], Logger::DEBUG);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2741,7 +2741,7 @@ class Diaspora
|
|||
$contact = [];
|
||||
}
|
||||
|
||||
Logger::log("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], Logger::DEBUG);
|
||||
|
||||
switch ($target_type) {
|
||||
case "Comment":
|
||||
|
@ -2871,7 +2871,7 @@ class Diaspora
|
|||
self::sendParticipation($contact, $datarray);
|
||||
|
||||
if ($message_id) {
|
||||
Logger::log("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
Logger::log("Stored item ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id);
|
||||
}
|
||||
|
@ -2923,7 +2923,7 @@ class Diaspora
|
|||
*/
|
||||
public static function encodePrivateData($msg, array $user, array $contact, $prvkey, $pubkey)
|
||||
{
|
||||
Logger::log("Message: ".$msg, LOGGER_DATA);
|
||||
Logger::log("Message: ".$msg, Logger::DATA);
|
||||
|
||||
// without a public key nothing will work
|
||||
if (!$pubkey) {
|
||||
|
@ -3141,8 +3141,8 @@ class Diaspora
|
|||
{
|
||||
$msg = self::buildPostXml($type, $message);
|
||||
|
||||
Logger::log('message: '.$msg, LOGGER_DATA);
|
||||
Logger::log('send guid '.$guid, LOGGER_DEBUG);
|
||||
Logger::log('message: '.$msg, Logger::DATA);
|
||||
Logger::log('send guid '.$guid, Logger::DEBUG);
|
||||
|
||||
// Fallback if the private key wasn't transmitted in the expected field
|
||||
if (empty($owner['uprvkey'])) {
|
||||
|
@ -3158,7 +3158,7 @@ class Diaspora
|
|||
$return_code = self::transmit($owner, $contact, $envelope, $public_batch, false, $guid);
|
||||
}
|
||||
|
||||
Logger::log("guid: ".$guid." result ".$return_code, LOGGER_DEBUG);
|
||||
Logger::log("guid: ".$guid." result ".$return_code, Logger::DEBUG);
|
||||
|
||||
return $return_code;
|
||||
}
|
||||
|
@ -3203,7 +3203,7 @@ class Diaspora
|
|||
"parent_type" => "Post",
|
||||
"parent_guid" => $item["guid"]];
|
||||
|
||||
Logger::log("Send participation for ".$item["guid"]." by ".$author, LOGGER_DEBUG);
|
||||
Logger::log("Send participation for ".$item["guid"]." by ".$author, Logger::DEBUG);
|
||||
|
||||
// It doesn't matter what we store, we only want to avoid sending repeated notifications for the same item
|
||||
Cache::set($cachekey, $item["guid"], Cache::QUARTER_HOUR);
|
||||
|
@ -3232,7 +3232,7 @@ class Diaspora
|
|||
"profile" => $profile,
|
||||
"signature" => $signature];
|
||||
|
||||
Logger::log("Send account migration ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Send account migration ".print_r($message, true), Logger::DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, "account_migration", $message);
|
||||
}
|
||||
|
@ -3275,7 +3275,7 @@ class Diaspora
|
|||
"following" => "true",
|
||||
"sharing" => "true"];
|
||||
|
||||
Logger::log("Send share ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Send share ".print_r($message, true), Logger::DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, "contact", $message);
|
||||
}
|
||||
|
@ -3295,7 +3295,7 @@ class Diaspora
|
|||
"following" => "false",
|
||||
"sharing" => "false"];
|
||||
|
||||
Logger::log("Send unshare ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Send unshare ".print_r($message, true), Logger::DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, "contact", $message);
|
||||
}
|
||||
|
@ -3808,7 +3808,7 @@ class Diaspora
|
|||
$type = "comment";
|
||||
}
|
||||
|
||||
Logger::log("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
|
||||
Logger::log("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", Logger::DEBUG);
|
||||
|
||||
// Old way - is used by the internal Friendica functions
|
||||
/// @todo Change all signatur storing functions to the new format
|
||||
|
@ -3832,13 +3832,13 @@ class Diaspora
|
|||
$message[$field] = $data;
|
||||
}
|
||||
} else {
|
||||
Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], LOGGER_DEBUG);
|
||||
Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
$message["parent_author_signature"] = self::signature($owner, $message);
|
||||
|
||||
Logger::log("Relayed data ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Relayed data ".print_r($message, true), Logger::DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, $type, $message, $public_batch, $item["guid"]);
|
||||
}
|
||||
|
@ -3872,7 +3872,7 @@ class Diaspora
|
|||
"target_guid" => $item['guid'],
|
||||
"target_type" => $target_type];
|
||||
|
||||
Logger::log("Got message ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Got message ".print_r($message, true), Logger::DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, $msg_type, $message, $public_batch, $item["guid"]);
|
||||
}
|
||||
|
@ -4108,7 +4108,7 @@ class Diaspora
|
|||
$message = self::createProfileData($uid);
|
||||
|
||||
foreach ($recips as $recip) {
|
||||
Logger::log("Send updated profile data for user ".$uid." to contact ".$recip["id"], LOGGER_DEBUG);
|
||||
Logger::log("Send updated profile data for user ".$uid." to contact ".$recip["id"], Logger::DEBUG);
|
||||
self::buildAndTransmit($owner, $recip, "profile", $message, false, "", false);
|
||||
}
|
||||
}
|
||||
|
@ -4125,7 +4125,7 @@ class Diaspora
|
|||
{
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (empty($owner)) {
|
||||
Logger::log("No owner post, so not storing signature", LOGGER_DEBUG);
|
||||
Logger::log("No owner post, so not storing signature", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4155,7 +4155,7 @@ class Diaspora
|
|||
{
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (empty($owner)) {
|
||||
Logger::log("No owner post, so not storing signature", LOGGER_DEBUG);
|
||||
Logger::log("No owner post, so not storing signature", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,21 +55,21 @@ class Email
|
|||
if (!$search1) {
|
||||
$search1 = [];
|
||||
} else {
|
||||
Logger::log("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::log("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::log("Found mails cc ".$email_addr, LOGGER_DEBUG);
|
||||
Logger::log("Found mails cc ".$email_addr, Logger::DEBUG);
|
||||
}
|
||||
|
||||
$res = array_unique(array_merge($search1, $search2, $search3));
|
||||
|
|
|
@ -41,12 +41,12 @@ class Feed {
|
|||
$a = get_app();
|
||||
|
||||
if (!$simulate) {
|
||||
Logger::log("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::log("Test Atom/RSS feed", LOGGER_DEBUG);
|
||||
Logger::log("Test Atom/RSS feed", Logger::DEBUG);
|
||||
}
|
||||
if (empty($xml)) {
|
||||
Logger::log('XML is empty.', LOGGER_DEBUG);
|
||||
Logger::log('XML is empty.', Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ class Feed {
|
|||
$header["contact-id"] = $contact["id"];
|
||||
|
||||
if (!is_object($entries)) {
|
||||
Logger::log("There are no entries in this feed.", LOGGER_DEBUG);
|
||||
Logger::log("There are no entries in this feed.", Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ class Feed {
|
|||
$importer["uid"], $item["uri"], Protocol::FEED, Protocol::DFRN];
|
||||
$previous = Item::selectFirst(['id'], $condition);
|
||||
if (DBA::isResult($previous)) {
|
||||
Logger::log("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;
|
||||
}
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ class Feed {
|
|||
}
|
||||
|
||||
if (!$simulate) {
|
||||
Logger::log("Stored feed: ".print_r($item, true), LOGGER_DEBUG);
|
||||
Logger::log("Stored feed: ".print_r($item, true), Logger::DEBUG);
|
||||
|
||||
$notify = Item::isRemoteSelf($contact, $item);
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ class OStatus
|
|||
DBA::update('contact', $contact, ['id' => $contact["id"]], $current);
|
||||
|
||||
if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) {
|
||||
Logger::log("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"]);
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ class OStatus
|
|||
self::$conv_list = [];
|
||||
}
|
||||
|
||||
Logger::log('Import OStatus message for user ' . $importer['uid'], LOGGER_DEBUG);
|
||||
Logger::log('Import OStatus message for user ' . $importer['uid'], Logger::DEBUG);
|
||||
|
||||
if ($xml == "") {
|
||||
return false;
|
||||
|
@ -349,7 +349,7 @@ class OStatus
|
|||
foreach ($hub_attributes as $hub_attribute) {
|
||||
if ($hub_attribute->name == "href") {
|
||||
$hub = $hub_attribute->textContent;
|
||||
Logger::log("Found hub ".$hub, LOGGER_DEBUG);
|
||||
Logger::log("Found hub ".$hub, Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -434,27 +434,27 @@ class OStatus
|
|||
|
||||
if (in_array($item["verb"], [NAMESPACE_OSTATUS."/unfavorite", ACTIVITY_UNFAVORITE])) {
|
||||
// Ignore "Unfavorite" message
|
||||
Logger::log("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::log('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::log('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::log("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::log("Ignore block message ".print_r($item, true), LOGGER_DEBUG);
|
||||
Logger::log("Ignore block message ".print_r($item, true), Logger::DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -481,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::log("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);
|
||||
|
@ -494,10 +494,10 @@ class OStatus
|
|||
// If not, then it depends on this setting
|
||||
$valid = !Config::get('system', 'ostatus_full_threads');
|
||||
if ($valid) {
|
||||
Logger::log("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::log("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
|
||||
|
@ -509,14 +509,14 @@ class OStatus
|
|||
}
|
||||
}
|
||||
if ($valid) {
|
||||
Logger::log("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::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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -533,9 +533,9 @@ class OStatus
|
|||
foreach (self::$itemlist as $item) {
|
||||
$found = Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]]);
|
||||
if ($found) {
|
||||
Logger::log("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::log("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')) {
|
||||
|
@ -551,7 +551,7 @@ class OStatus
|
|||
}
|
||||
self::$itemlist = [];
|
||||
}
|
||||
Logger::log('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;
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ class OStatus
|
|||
self::fetchRelated($related, $item["parent-uri"], $importer);
|
||||
}
|
||||
} else {
|
||||
Logger::log('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"];
|
||||
|
@ -853,11 +853,11 @@ class OStatus
|
|||
|
||||
$condition = ['item-uri' => $conv_data['uri'],'protocol' => Conversation::PARCEL_FEED];
|
||||
if (DBA::exists('conversation', $condition)) {
|
||||
Logger::log('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::log('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);
|
||||
}
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ class OStatus
|
|||
{
|
||||
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $self, Conversation::PARCEL_DFRN, Conversation::PARCEL_SALMON];
|
||||
if (DBA::exists('conversation', $condition)) {
|
||||
Logger::log('Conversation '.$item['uri'].' is already stored.', LOGGER_DEBUG);
|
||||
Logger::log('Conversation '.$item['uri'].' is already stored.', Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -897,7 +897,7 @@ class OStatus
|
|||
$item["protocol"] = Conversation::PARCEL_SALMON;
|
||||
$item["source"] = $xml;
|
||||
|
||||
Logger::log('Conversation '.$item['uri'].' is now fetched.', LOGGER_DEBUG);
|
||||
Logger::log('Conversation '.$item['uri'].' is now fetched.', Logger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -916,11 +916,11 @@ class OStatus
|
|||
$stored = true;
|
||||
$xml = $conversation['source'];
|
||||
if (self::process($xml, $importer, $contact, $hub, $stored, false)) {
|
||||
Logger::log('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::log('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]);
|
||||
}
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ class OStatus
|
|||
$xml = '';
|
||||
|
||||
if (stristr($curlResult->getHeader(), 'Content-Type: application/atom+xml')) {
|
||||
Logger::log('Directly fetched XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
Logger::log('Directly fetched XML for URI ' . $related_uri, Logger::DEBUG);
|
||||
$xml = $curlResult->getBody();
|
||||
}
|
||||
|
||||
|
@ -960,7 +960,7 @@ class OStatus
|
|||
$curlResult = Network::curl($atom_file);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::log('Fetched XML for URI ' . $related_uri, LOGGER_DEBUG);
|
||||
Logger::log('Fetched XML for URI ' . $related_uri, Logger::DEBUG);
|
||||
$xml = $curlResult->getBody();
|
||||
}
|
||||
}
|
||||
|
@ -972,7 +972,7 @@ class OStatus
|
|||
$curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related).'.atom');
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::log('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();
|
||||
}
|
||||
}
|
||||
|
@ -983,7 +983,7 @@ class OStatus
|
|||
$curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom');
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::log('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();
|
||||
}
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ class OStatus
|
|||
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
|
||||
if (DBA::isResult($conversation)) {
|
||||
$stored = true;
|
||||
Logger::log('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'];
|
||||
}
|
||||
}
|
||||
|
@ -1002,7 +1002,7 @@ class OStatus
|
|||
if ($xml != '') {
|
||||
self::process($xml, $importer, $contact, $hub, $stored, false);
|
||||
} else {
|
||||
Logger::log("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;
|
||||
}
|
||||
|
@ -1652,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::log("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);
|
||||
|
@ -1715,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::log("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);
|
||||
|
@ -1862,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::log("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);
|
||||
|
@ -2153,7 +2153,7 @@ class OStatus
|
|||
if ((time() - strtotime($owner['last-item'])) < 15*60) {
|
||||
$result = Cache::get($cachekey);
|
||||
if (!$nocache && !is_null($result)) {
|
||||
Logger::log('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'];
|
||||
}
|
||||
|
@ -2213,7 +2213,7 @@ class OStatus
|
|||
$msg = ['feed' => $feeddata, 'last_update' => $last_update];
|
||||
Cache::set($cachekey, $msg, Cache::QUARTER_HOUR);
|
||||
|
||||
Logger::log('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;
|
||||
}
|
||||
|
|
|
@ -85,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::log('load: ' . $url, LOGGER_DEBUG);
|
||||
Logger::log('load: ' . $url, Logger::DEBUG);
|
||||
|
||||
$fetchresult = Network::fetchUrlFull($url);
|
||||
$s = $fetchresult->getBody();
|
||||
|
||||
Logger::log('load: returns ' . $s, LOGGER_DATA);
|
||||
Logger::log('load: returns ' . $s, Logger::DATA);
|
||||
|
||||
Logger::log('load: return code: ' . $fetchresult->getReturnCode(), LOGGER_DEBUG);
|
||||
Logger::log('load: return code: ' . $fetchresult->getReturnCode(), Logger::DEBUG);
|
||||
|
||||
if (($fetchresult->getReturnCode() > 299) || (! $s)) {
|
||||
return;
|
||||
|
@ -100,7 +100,7 @@ class PortableContact
|
|||
|
||||
$j = json_decode($s, true);
|
||||
|
||||
Logger::log('load: json: ' . print_r($j, true), LOGGER_DATA);
|
||||
Logger::log('load: json: ' . print_r($j, true), Logger::DATA);
|
||||
|
||||
if (!isset($j['entry'])) {
|
||||
return;
|
||||
|
@ -200,10 +200,10 @@ class PortableContact
|
|||
|
||||
GContact::link($gcid, $uid, $cid, $zcid);
|
||||
} catch (Exception $e) {
|
||||
Logger::log($e->getMessage(), LOGGER_DEBUG);
|
||||
Logger::log($e->getMessage(), Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
Logger::log("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);
|
||||
|
@ -336,7 +336,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (!in_array($gcontacts[0]["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::FEED, Protocol::OSTATUS, ""])) {
|
||||
Logger::log("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;
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ class PortableContact
|
|||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
}
|
||||
|
||||
Logger::log("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;
|
||||
|
@ -427,7 +427,7 @@ class PortableContact
|
|||
$fields = ['last_contact' => DateTimeFormat::utcNow()];
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
Logger::log("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"];
|
||||
}
|
||||
|
@ -438,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::log("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"];
|
||||
|
@ -465,10 +465,10 @@ class PortableContact
|
|||
|
||||
self::lastUpdated($data["url"], $force);
|
||||
} catch (Exception $e) {
|
||||
Logger::log($e->getMessage(), LOGGER_DEBUG);
|
||||
Logger::log($e->getMessage(), Logger::DEBUG);
|
||||
}
|
||||
|
||||
Logger::log("Profile ".$profile." was deleted", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." was deleted", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ class PortableContact
|
|||
$fields = ['last_failure' => DateTimeFormat::utcNow()];
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
Logger::log("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." wasn't reachable (profile)", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,7 @@ class PortableContact
|
|||
$fields = ['last_failure' => DateTimeFormat::utcNow()];
|
||||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
Logger::log("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG);
|
||||
Logger::log("Profile ".$profile." wasn't reachable (no feed)", Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -540,7 +540,7 @@ class PortableContact
|
|||
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
}
|
||||
|
||||
Logger::log("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;
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ class PortableContact
|
|||
|
||||
foreach ($nodeinfo['links'] as $link) {
|
||||
if (!is_array($link) || empty($link['rel'])) {
|
||||
Logger::log('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') {
|
||||
|
@ -964,7 +964,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (!$force && !self::updateNeeded($gserver["created"], "", $last_failure, $last_contact)) {
|
||||
Logger::log("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 {
|
||||
|
@ -980,7 +980,7 @@ class PortableContact
|
|||
$last_contact = DBA::NULL_DATETIME;
|
||||
$last_failure = DBA::NULL_DATETIME;
|
||||
}
|
||||
Logger::log("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;
|
||||
|
@ -1005,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::log("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;
|
||||
}
|
||||
|
@ -1020,7 +1020,7 @@ class PortableContact
|
|||
|
||||
// Quit if there is a timeout
|
||||
if ($curlResult->isTimeout()) {
|
||||
Logger::log("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;
|
||||
}
|
||||
|
@ -1399,9 +1399,9 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (($last_contact <= $last_failure) && !$failure) {
|
||||
Logger::log("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::log("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
|
||||
|
@ -1430,7 +1430,7 @@ class PortableContact
|
|||
self::discoverRelay($server_url);
|
||||
}
|
||||
|
||||
Logger::log("End discovery for server " . $server_url, LOGGER_DEBUG);
|
||||
Logger::log("End discovery for server " . $server_url, Logger::DEBUG);
|
||||
|
||||
return !$failure;
|
||||
}
|
||||
|
@ -1442,7 +1442,7 @@ class PortableContact
|
|||
*/
|
||||
private static function discoverRelay($server_url)
|
||||
{
|
||||
Logger::log("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");
|
||||
|
||||
|
@ -1558,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::log("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);
|
||||
}
|
||||
}
|
||||
|
@ -1643,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::log("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);
|
||||
|
||||
|
@ -1671,7 +1671,7 @@ class PortableContact
|
|||
$curlResult = Network::curl($url);
|
||||
|
||||
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
|
||||
Logger::log("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)) {
|
||||
|
@ -1680,7 +1680,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (!$success && (Config::get('system', 'poco_discovery') > 2)) {
|
||||
Logger::log("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);
|
||||
}
|
||||
}
|
||||
|
@ -1733,7 +1733,7 @@ class PortableContact
|
|||
continue;
|
||||
}
|
||||
|
||||
Logger::log('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)) {
|
||||
|
@ -1763,7 +1763,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if ($username != '') {
|
||||
Logger::log('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';
|
||||
|
@ -1866,7 +1866,7 @@ class PortableContact
|
|||
if ($generation > 0) {
|
||||
$success = true;
|
||||
|
||||
Logger::log("Store profile ".$profile_url, LOGGER_DEBUG);
|
||||
Logger::log("Store profile ".$profile_url, Logger::DEBUG);
|
||||
|
||||
$gcontact = ["url" => $profile_url,
|
||||
"name" => $name,
|
||||
|
@ -1885,10 +1885,10 @@ class PortableContact
|
|||
$gcontact = GContact::sanitize($gcontact);
|
||||
GContact::update($gcontact);
|
||||
} catch (Exception $e) {
|
||||
Logger::log($e->getMessage(), LOGGER_DEBUG);
|
||||
Logger::log($e->getMessage(), Logger::DEBUG);
|
||||
}
|
||||
|
||||
Logger::log("Done for profile ".$profile_url, LOGGER_DEBUG);
|
||||
Logger::log("Done for profile ".$profile_url, Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
return $success;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue