use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Markdown;
use Friendica\Core\Cache\Enum\Duration;
-use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
public static function participantsForThread(array $item, array $contacts): array
{
if (!in_array($item['private'], [Item::PUBLIC, Item::UNLISTED]) || in_array($item['verb'], [Activity::FOLLOW, Activity::TAG])) {
- Logger::info('Item is private or a participation request. It will not be relayed', ['guid' => $item['guid'], 'private' => $item['private'], 'verb' => $item['verb']]);
+ DI::logger()->info('Item is private or a participation request. It will not be relayed', ['guid' => $item['guid'], 'private' => $item['private'], 'verb' => $item['verb']]);
return $contacts;
}
}
if (!$exists) {
- Logger::info('Add participant to receiver list', ['parent' => $item['parent-guid'], 'item' => $item['guid'], 'participant' => $contact['url']]);
+ DI::logger()->info('Add participant to receiver list', ['parent' => $item['parent-guid'], 'item' => $item['guid'], 'participant' => $contact['url']]);
$contacts[] = $contact;
}
}
$basedom = XML::parseString($envelope, true);
if (!is_object($basedom)) {
- Logger::notice('Envelope is no XML file');
+ DI::logger()->notice('Envelope is no XML file');
return false;
}
$children = $basedom->children(ActivityNamespace::SALMON_ME);
if (sizeof($children) == 0) {
- Logger::notice('XML has no children');
+ DI::logger()->notice('XML has no children');
return false;
}
$signable_data = $msg . '.' . Strings::base64UrlEncode($type) . '.' . Strings::base64UrlEncode($encoding) . '.' . Strings::base64UrlEncode($alg);
if ($handle == '') {
- Logger::notice('No author could be decoded. Discarding. Message: ' . $envelope);
+ DI::logger()->notice('No author could be decoded. Discarding. Message: ' . $envelope);
return false;
}
throw new \InvalidArgumentException();
}
} catch (\InvalidArgumentException $e) {
- Logger::notice("Couldn't get a key for handle " . $handle . ". Discarding.");
+ DI::logger()->notice("Couldn't get a key for handle " . $handle . ". Discarding.");
return false;
}
$verify = Crypto::rsaVerify($signable_data, $sig, $key);
if (!$verify) {
- Logger::notice('Message from ' . $handle . ' did not verify. Discarding.');
+ DI::logger()->notice('Message from ' . $handle . ' did not verify. Discarding.');
return false;
}
if (is_object($data)) {
try {
if (!isset($data->aes_key) || !isset($data->encrypted_magic_envelope)) {
- Logger::info('Missing keys "aes_key" and/or "encrypted_magic_envelope"', ['data' => $data]);
+ DI::logger()->info('Missing keys "aes_key" and/or "encrypted_magic_envelope"', ['data' => $data]);
throw new \RuntimeException('Missing keys "aes_key" and/or "encrypted_magic_envelope"');
}
$j_outer_key_bundle = json_decode($outer_key_bundle);
if (!is_object($j_outer_key_bundle)) {
- Logger::info('Unable to decode outer key bundle', ['outer_key_bundle' => $outer_key_bundle]);
+ DI::logger()->info('Unable to decode outer key bundle', ['outer_key_bundle' => $outer_key_bundle]);
throw new \RuntimeException('Unable to decode outer key bundle');
}
if (!isset($j_outer_key_bundle->iv) || !isset($j_outer_key_bundle->key)) {
- Logger::info('Missing keys "iv" and/or "key" from outer Salmon', ['j_outer_key_bundle' => $j_outer_key_bundle]);
+ DI::logger()->info('Missing keys "iv" and/or "key" from outer Salmon', ['j_outer_key_bundle' => $j_outer_key_bundle]);
throw new \RuntimeException('Missing keys "iv" and/or "key" from outer Salmon');
}
$xml = self::aesDecrypt($outer_key, $outer_iv, $ciphertext);
} catch (\Throwable $e) {
- Logger::notice('Outer Salmon did not verify. Discarding.');
+ DI::logger()->notice('Outer Salmon did not verify. Discarding.');
if ($no_exit) {
return false;
} else {
$basedom = XML::parseString($xml, true);
if (!is_object($basedom)) {
- Logger::notice('Received data does not seem to be an XML. Discarding. ' . $xml);
+ DI::logger()->notice('Received data does not seem to be an XML. Discarding. ' . $xml);
if ($no_exit) {
return false;
} else {
$key_id = $base->sig[0]->attributes()->key_id[0];
$author_addr = base64_decode($key_id);
if ($author_addr == '') {
- Logger::notice('No author could be decoded. Discarding. Message: ' . $xml);
+ DI::logger()->notice('No author could be decoded. Discarding. Message: ' . $xml);
if ($no_exit) {
return false;
} else {
throw new \InvalidArgumentException();
}
} catch (\InvalidArgumentException $e) {
- Logger::notice("Couldn't get a key for handle " . $author_addr . ". Discarding.");
+ DI::logger()->notice("Couldn't get a key for handle " . $author_addr . ". Discarding.");
if ($no_exit) {
return false;
} else {
$verify = Crypto::rsaVerify($signed_data, $signature, $key);
if (!$verify) {
- Logger::notice('Message did not verify. Discarding.');
+ DI::logger()->notice('Message did not verify. Discarding.');
if ($no_exit) {
return false;
} else {
$basedom = XML::parseString($xml);
if (!is_object($basedom)) {
- Logger::notice('XML is not parseable.');
+ DI::logger()->notice('XML is not parseable.');
return false;
}
$children = $basedom->children('https://joindiaspora.com/protocol');
} else {
// This happens with posts from a relais
if (empty($privKey)) {
- Logger::info('This is no private post in the old format');
+ DI::logger()->info('This is no private post in the old format');
return false;
}
$decrypted = self::aesDecrypt($outer_key, $outer_iv, $ciphertext);
- Logger::info('decrypted', ['data' => $decrypted]);
+ DI::logger()->info('decrypted', ['data' => $decrypted]);
$idom = XML::parseString($decrypted);
$inner_iv = base64_decode($idom->iv);
try {
$author = WebFingerUri::fromString($idom->author_id);
} catch (\Throwable $e) {
- Logger::notice('Could not retrieve author URI.', ['idom' => $idom]);
+ DI::logger()->notice('Could not retrieve author URI.', ['idom' => $idom]);
throw new \Friendica\Network\HTTPException\BadRequestException();
}
}
if (!$base) {
- Logger::notice('unable to locate salmon data in xml');
+ DI::logger()->notice('unable to locate salmon data in xml');
throw new HTTPException\BadRequestException();
}
// Once we have the author URI, go to the web and try to find their public key
// (first this will look it up locally if it is in the diaspora-contact cache)
// This will also convert diaspora public key from pkcs#1 to pkcs#8
- Logger::info('Fetching key for ' . $author);
+ DI::logger()->info('Fetching key for ' . $author);
$key = self::key($author);
if (!$key) {
- Logger::notice('Could not retrieve author key.');
+ DI::logger()->notice('Could not retrieve author key.');
throw new HTTPException\BadRequestException();
}
$verify = Crypto::rsaVerify($signed_data, $signature, $key);
if (!$verify) {
- Logger::notice('Message did not verify. Discarding.');
+ DI::logger()->notice('Message did not verify. Discarding.');
throw new HTTPException\BadRequestException();
}
- Logger::info('Message verified.');
+ DI::logger()->info('Message verified.');
return [
'message' => $inner_decrypted,
public static function dispatchPublic(array $msg, int $direction)
{
if (!DI::config()->get('system', 'diaspora_enabled')) {
- Logger::notice('Diaspora is disabled');
+ DI::logger()->notice('Diaspora is disabled');
return false;
}
if (!($fields = self::validPosting($msg))) {
- Logger::notice('Invalid posting', ['msg' => $msg]);
+ DI::logger()->notice('Invalid posting', ['msg' => $msg]);
return false;
}
if (is_null($fields)) {
$private = true;
if (!($fields = self::validPosting($msg))) {
- Logger::notice('Invalid posting', ['msg' => $msg]);
+ DI::logger()->notice('Invalid posting', ['msg' => $msg]);
return false;
}
} else {
$type = $fields->getName();
- Logger::info('Received message', ['type' => $type, 'sender' => $sender->getAddr(), 'user' => $importer['uid']]);
+ DI::logger()->info('Received message', ['type' => $type, 'sender' => $sender->getAddr(), 'user' => $importer['uid']]);
switch ($type) {
case 'account_migration':
if (!$private) {
- Logger::notice('Message with type ' . $type . ' is not private, quitting.');
+ DI::logger()->notice('Message with type ' . $type . ' is not private, quitting.');
return false;
}
return self::receiveAccountMigration($importer, $fields);
case 'contact':
if (!$private) {
- Logger::notice('Message with type ' . $type . ' is not private, quitting.');
+ DI::logger()->notice('Message with type ' . $type . ' is not private, quitting.');
return false;
}
return self::receiveContactRequest($importer, $fields);
case 'conversation':
if (!$private) {
- Logger::notice('Message with type ' . $type . ' is not private, quitting.');
+ DI::logger()->notice('Message with type ' . $type . ' is not private, quitting.');
return false;
}
return self::receiveConversation($importer, $msg, $fields);
case 'message':
if (!$private) {
- Logger::notice('Message with type ' . $type . ' is not private, quitting.');
+ DI::logger()->notice('Message with type ' . $type . ' is not private, quitting.');
return false;
}
return self::receiveMessage($importer, $fields);
case 'participation':
if (!$private) {
- Logger::notice('Message with type ' . $type . ' is not private, quitting.');
+ DI::logger()->notice('Message with type ' . $type . ' is not private, quitting.');
return false;
}
return self::receiveParticipation($importer, $fields, $direction);
case 'profile':
if (!$private) {
- Logger::notice('Message with type ' . $type . ' is not private, quitting.');
+ DI::logger()->notice('Message with type ' . $type . ' is not private, quitting.');
return false;
}
return self::receiveProfile($importer, $fields);
return self::receiveStatusMessage($importer, $fields, $msg['message'], $direction);
default:
- Logger::notice('Unknown message type ' . $type);
+ DI::logger()->notice('Unknown message type ' . $type);
return false;
}
}
$element = XML::parseString($msg['message']);
if (!is_object($element)) {
- Logger::info('No valid XML', ['message' => $msg['message']]);
+ DI::logger()->info('No valid XML', ['message' => $msg['message']]);
return false;
}
$type = $element->getName();
$orig_type = $type;
- Logger::debug('Got message', ['type' => $type, 'message' => $msg['message']]);
+ DI::logger()->debug('Got message', ['type' => $type, 'message' => $msg['message']]);
// All retractions are handled identically from now on.
// In the new version there will only be "retraction".
// This is something that shouldn't happen at all.
if (in_array($type, ['status_message', 'reshare', 'profile'])) {
if ($msg['author'] != $fields->author) {
- Logger::notice('Message handle is not the same as envelope sender. Quitting this message.', ['author1' => $msg['author'], 'author2' => $fields->author]);
+ DI::logger()->notice('Message handle is not the same as envelope sender. Quitting this message.', ['author1' => $msg['author'], 'author2' => $fields->author]);
return false;
}
}
}
if (!isset($author_signature) && ($msg['author'] == $fields->author)) {
- Logger::debug('No author signature, but the sender matches the author', ['type' => $type, 'msg-author' => $msg['author'], 'message' => $msg['message']]);
+ DI::logger()->debug('No author signature, but the sender matches the author', ['type' => $type, 'msg-author' => $msg['author'], 'message' => $msg['message']]);
return $fields;
}
// No author_signature? This is a must, so we quit.
if (!isset($author_signature)) {
- Logger::info('No author signature', ['type' => $type, 'msg-author' => $msg['author'], 'fields-author' => $fields->author, 'message' => $msg['message']]);
+ DI::logger()->info('No author signature', ['type' => $type, 'msg-author' => $msg['author'], 'fields-author' => $fields->author, 'message' => $msg['message']]);
return false;
}
if (isset($parent_author_signature)) {
$key = self::key(WebFingerUri::fromString($msg['author']));
if (empty($key)) {
- Logger::info('No key found for parent', ['author' => $msg['author']]);
+ DI::logger()->info('No key found for parent', ['author' => $msg['author']]);
return false;
}
if (!Crypto::rsaVerify($signed_data, $parent_author_signature, $key, 'sha256')) {
- Logger::info('No valid parent author signature', ['author' => $msg['author'], 'type' => $type, 'signed data' => $signed_data, 'message' => $msg['message'], 'signature' => $parent_author_signature]);
+ DI::logger()->info('No valid parent author signature', ['author' => $msg['author'], 'type' => $type, 'signed data' => $signed_data, 'message' => $msg['message'], 'signature' => $parent_author_signature]);
return false;
}
}
throw new \InvalidArgumentException();
}
} catch (\Throwable $e) {
- Logger::info('No key found', ['author' => $fields->author]);
+ DI::logger()->info('No key found', ['author' => $fields->author]);
return false;
}
if (!Crypto::rsaVerify($signed_data, $author_signature, $key, 'sha256')) {
- Logger::info('No valid author signature for author', ['author' => $fields->author, 'type' => $type, 'signed data' => $signed_data, 'message' => $msg['message'], 'signature' => $author_signature]);
+ DI::logger()->info('No valid author signature for author', ['author' => $fields->author, 'type' => $type, 'signed data' => $signed_data, 'message' => $msg['message'], 'signature' => $author_signature]);
return false;
} else {
return $fields;
*/
private static function key(WebFingerUri $uri): string
{
- Logger::info('Fetching diaspora key', ['handle' => $uri->getAddr()]);
+ DI::logger()->info('Fetching diaspora key', ['handle' => $uri->getAddr()]);
try {
return DI::dsprContact()->getByAddr($uri)->pubKey;
} catch (NotFoundException | \InvalidArgumentException $e) {
// );
//
// $contact["rel"] = Contact::FRIEND;
- // Logger::notice("defining user ".$contact["nick"]." as friend");
+ // DI::logger()->notice("defining user ".$contact["nick"]." as friend");
//}
// Contact server is blocked
{
$contact = self::contactByHandle($importer['uid'], $contact_uri);
if (!$contact) {
- Logger::notice('A Contact for handle ' . $contact_uri . ' and user ' . $importer['uid'] . ' was not found');
+ DI::logger()->notice('A Contact for handle ' . $contact_uri . ' and user ' . $importer['uid'] . ' was not found');
// If a contact isn't found, we accept it anyway if it is a comment
if ($is_comment && ($importer['uid'] != 0)) {
return self::contactByHandle(0, $contact_uri);
}
if (!self::postAllow($importer, $contact, $is_comment)) {
- Logger::notice('The handle: ' . $contact_uri . ' is not allowed to post to user ' . $importer['uid']);
+ DI::logger()->notice('The handle: ' . $contact_uri . ' is not allowed to post to user ' . $importer['uid']);
return false;
}
return $contact;
{
$item = Post::selectFirst(['id'], ['uid' => $uid, 'guid' => $guid]);
if (DBA::isResult($item)) {
- Logger::notice('Message already exists.', ['uid' => $uid, 'guid' => $guid, 'id' => $item['id']]);
+ DI::logger()->notice('Message already exists.', ['uid' => $uid, 'guid' => $guid, 'id' => $item['id']]);
return $item['id'];
}
$server = $serverparts['scheme'] . '://' . $serverparts['host'];
- Logger::info('Trying to fetch item ' . $guid . ' from ' . $server);
+ DI::logger()->info('Trying to fetch item ' . $guid . ' from ' . $server);
$msg = self::message($guid, $server);
return false;
}
- Logger::info('Successfully fetched item ' . $guid . ' from ' . $server);
+ DI::logger()->info('Successfully fetched item ' . $guid . ' from ' . $server);
// Now call the dispatcher
return self::dispatchPublic($msg, $force ? self::FORCED_FETCH : self::FETCHED);
// This will work for new Diaspora servers and Friendica servers from 3.5
$source_url = $server . '/fetch/post/' . urlencode($guid);
- Logger::info('Fetch post from ' . $source_url);
+ DI::logger()->info('Fetch post from ' . $source_url);
$envelope = DI::httpClient()->fetch($source_url, HttpClientAccept::MAGIC, 0, '', HttpClientRequest::DIASPORA);
if ($envelope) {
- Logger::info('Envelope was fetched.');
+ DI::logger()->info('Envelope was fetched.');
$x = self::verifyMagicEnvelope($envelope);
if (!$x) {
- Logger::info('Envelope could not be verified.');
+ DI::logger()->info('Envelope could not be verified.');
} else {
- Logger::info('Envelope was verified.');
+ DI::logger()->info('Envelope was verified.');
}
} else {
$x = false;
if ($source_xml->post->reshare) {
// Reshare of a reshare - old Diaspora version
- Logger::info('Message is a reshare');
+ DI::logger()->info('Message is a reshare');
return self::message($source_xml->post->reshare->root_guid, $server, ++$level);
} elseif ($source_xml->getName() == 'reshare') {
// Reshare of a reshare - new Diaspora version
- Logger::info('Message is a new reshare');
+ DI::logger()->info('Message is a new reshare');
return self::message($source_xml->root_guid, $server, ++$level);
}
$author = WebFingerUri::fromString($author_handle);
} catch (\InvalidArgumentException $e) {
// If this isn't a "status_message" then quit
- Logger::info("Message doesn't seem to be a status message");
+ DI::logger()->info("Message doesn't seem to be a status message");
return false;
}
{
// Check for Diaspora (and Friendica) typical paths
if (!preg_match('=(https?://.+)/(?:posts|display|objects)/([a-zA-Z0-9-_@.:%]+[a-zA-Z0-9])=i', $url, $matches)) {
- Logger::notice('Invalid url', ['url' => $url]);
+ DI::logger()->notice('Invalid url', ['url' => $url]);
return false;
}
$item = Post::selectFirst(['id'], ['guid' => $guid, 'uid' => $uid]);
if (DBA::isResult($item)) {
- Logger::info('Found', ['id' => $item['id']]);
+ DI::logger()->info('Found', ['id' => $item['id']]);
return $item['id'];
}
- Logger::info('Fetch GUID from origin', ['guid' => $guid, 'server' => $matches[1]]);
+ DI::logger()->info('Fetch GUID from origin', ['guid' => $guid, 'server' => $matches[1]]);
$ret = self::storeByGuid($guid, $matches[1], true);
- Logger::info('Result', ['ret' => $ret]);
+ DI::logger()->info('Result', ['ret' => $ret]);
$item = Post::selectFirst(['id'], ['guid' => $guid, 'uid' => $uid]);
if (DBA::isResult($item)) {
- Logger::info('Found', ['id' => $item['id']]);
+ DI::logger()->info('Found', ['id' => $item['id']]);
return $item['id'];
} else {
- Logger::notice('Not found', ['guid' => $guid, 'uid' => $uid]);
+ DI::logger()->notice('Not found', ['guid' => $guid, 'uid' => $uid]);
return false;
}
}
}
if ($result) {
- Logger::info('Fetched missing item ' . $guid . ' - result: ' . $result);
+ DI::logger()->info('Fetched missing item ' . $guid . ' - result: ' . $result);
$item = Post::selectFirst($fields, $condition);
}
} catch (HTTPException\NotFoundException $e) {
- Logger::notice('Unable to retrieve author details', ['author' => $author->getAddr()]);
+ DI::logger()->notice('Unable to retrieve author details', ['author' => $author->getAddr()]);
}
}
if (!DBA::isResult($item)) {
- Logger::notice('Parent item not found: parent: ' . $guid . ' - user: ' . $uid);
+ DI::logger()->notice('Parent item not found: parent: ' . $guid . ' - user: ' . $uid);
return false;
} else {
- Logger::info('Parent item found: parent: ' . $guid . ' - user: ' . $uid);
+ DI::logger()->info('Parent item found: parent: ' . $guid . ' - user: ' . $uid);
return $item;
}
}
{
$contact = Contact::getByURL($addr);
if (empty($contact)) {
- Logger::info('No contact data for address', ['addr' => $addr]);
+ DI::logger()->info('No contact data for address', ['addr' => $addr]);
return '';
}
if (empty($contact['baseurl'])) {
$contact['baseurl'] = 'https://' . substr($addr, strpos($addr, '@') + 1);
- Logger::info('Create baseurl from address', ['baseurl' => $contact['baseurl'], 'url' => $contact['url']]);
+ DI::logger()->info('Create baseurl from address', ['baseurl' => $contact['baseurl'], 'url' => $contact['url']]);
}
$platform = '';
$gserver = DBA::selectFirst('gserver', ['platform'], ['nurl' => Strings::normaliseLink($contact['baseurl'])]);
if (!empty($gserver['platform'])) {
$platform = strtolower($gserver['platform']);
- Logger::info('Detected platform', ['platform' => $platform, 'url' => $contact['url']]);
+ DI::logger()->info('Detected platform', ['platform' => $platform, 'url' => $contact['url']]);
}
if (!in_array($platform, ['diaspora', 'friendica', 'hubzilla', 'socialhome'])) {
if (self::isHubzilla($contact['url'])) {
- Logger::info('Detected unknown platform as Hubzilla', ['platform' => $platform, 'url' => $contact['url']]);
+ DI::logger()->info('Detected unknown platform as Hubzilla', ['platform' => $platform, 'url' => $contact['url']]);
$platform = 'hubzilla';
} elseif ($contact['network'] == Protocol::DFRN) {
- Logger::info('Detected unknown platform as Friendica', ['platform' => $platform, 'url' => $contact['url']]);
+ DI::logger()->info('Detected unknown platform as Friendica', ['platform' => $platform, 'url' => $contact['url']]);
$platform = 'friendica';
}
}
}
if ($platform != 'diaspora') {
- Logger::info('Unknown platform', ['platform' => $platform, 'url' => $contact['url']]);
+ DI::logger()->info('Unknown platform', ['platform' => $platform, 'url' => $contact['url']]);
return '';
}
$old_author = WebFingerUri::fromString(XML::unescape($data->author));
$new_author = WebFingerUri::fromString(XML::unescape($data->profile->author));
} catch (\Throwable $e) {
- Logger::notice('Cannot find handles for sender and user', ['data' => $data]);
+ DI::logger()->notice('Cannot find handles for sender and user', ['data' => $data]);
return false;
}
$contact = self::contactByHandle($importer['uid'], $old_author);
if (!$contact) {
- Logger::notice('Cannot find contact for sender: ' . $old_author . ' and user ' . $importer['uid']);
+ DI::logger()->notice('Cannot find contact for sender: ' . $old_author . ' and user ' . $importer['uid']);
return false;
}
- Logger::info('Got migration for ' . $old_author . ', to ' . $new_author . ' with user ' . $importer['uid']);
+ DI::logger()->info('Got migration for ' . $old_author . ', to ' . $new_author . ' with user ' . $importer['uid']);
// Check signature
$signed_text = 'AccountMigration:' . $old_author . ':' . $new_author;
$key = self::key($old_author);
if (!Crypto::rsaVerify($signed_text, $signature, $key, 'sha256')) {
- Logger::notice('No valid signature for migration.');
+ DI::logger()->notice('No valid signature for migration.');
return false;
}
// change the technical stuff in contact
$data = Probe::uri($new_author);
if ($data['network'] == Protocol::PHANTOM) {
- Logger::notice("Account for " . $new_author . " couldn't be probed.");
+ DI::logger()->notice("Account for " . $new_author . " couldn't be probed.");
return false;
}
Contact::update($fields, ['addr' => $old_author->getAddr()]);
- Logger::info('Contacts are updated.');
+ DI::logger()->info('Contacts are updated.');
return true;
}
}
DBA::close($contacts);
- Logger::info('Removed contacts for ' . $author_handle);
+ DI::logger()->info('Removed contacts for ' . $author_handle);
return true;
}
try {
$author_url = (string)DI::dsprContact()->getByAddr($author)->url;
} catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
- Logger::notice('Unable to find author details', ['author' => $author->getAddr()]);
+ DI::logger()->notice('Unable to find author details', ['author' => $author->getAddr()]);
return false;
}
}
if (DI::contentItem()->isTooOld($datarray['created'], $datarray['uid'])) {
- Logger::info('Comment is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
+ DI::logger()->info('Comment is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
return false;
}
}
if ($message_id) {
- Logger::info('Stored comment ' . $datarray['guid'] . ' with message id ' . $message_id);
+ DI::logger()->info('Stored comment ' . $datarray['guid'] . ' with message id ' . $message_id);
if ($datarray['uid'] == 0) {
Item::distribute($message_id, json_encode($data));
}
$msg_created_at = DateTimeFormat::utc(XML::unescape($mesg->created_at));
if ($msg_conversation_guid != $guid) {
- Logger::notice('Message conversation guid does not belong to the current conversation.', ['guid' => $guid]);
+ DI::logger()->notice('Message conversation guid does not belong to the current conversation.', ['guid' => $guid]);
return false;
}
$messages = $data->message;
if (!count($messages)) {
- Logger::notice('Empty conversation');
+ DI::logger()->notice('Empty conversation');
return false;
}
}
}
if (!$conversation) {
- Logger::warning('Unable to create conversation.');
+ DI::logger()->warning('Unable to create conversation.');
return false;
}
try {
$author_url = (string)DI::dsprContact()->getByAddr($author)->url;
} catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
- Logger::notice('Unable to find author details', ['author' => $author->getAddr()]);
+ DI::logger()->notice('Unable to find author details', ['author' => $author->getAddr()]);
return false;
}
}
if (DI::contentItem()->isTooOld($datarray['created'], $datarray['uid'])) {
- Logger::info('Like is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
+ DI::logger()->info('Like is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
return false;
}
}
if ($message_id) {
- Logger::info('Stored like ' . $datarray['guid'] . ' with message id ' . $message_id);
+ DI::logger()->info('Stored like ' . $datarray['guid'] . ' with message id ' . $message_id);
if ($datarray['uid'] == 0) {
Item::distribute($message_id, json_encode($data));
}
$condition = ['uid' => $importer['uid'], 'guid' => $conversation_guid];
$conversation = DBA::selectFirst('conv', [], $condition);
if (!DBA::isResult($conversation)) {
- Logger::notice('Conversation not available.');
+ DI::logger()->notice('Conversation not available.');
return false;
}
try {
$author = DI::dsprContact()->getByAddr($author_uri);
} catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
- Logger::notice('Unable to find author details', ['author' => $author_uri->getAddr()]);
+ DI::logger()->notice('Unable to find author details', ['author' => $author_uri->getAddr()]);
return false;
}
}
if (!$toplevel_parent_item['origin']) {
- Logger::info('Not our origin. Participation is ignored', ['parent_guid' => $parent_guid, 'guid' => $guid, 'author' => $author]);
+ DI::logger()->info('Not our origin. Participation is ignored', ['parent_guid' => $parent_guid, 'guid' => $guid, 'author' => $author]);
}
if (!in_array($toplevel_parent_item['private'], [Item::PUBLIC, Item::UNLISTED])) {
- Logger::info('Item is not public, participation is ignored', ['parent_guid' => $parent_guid, 'guid' => $guid, 'author' => $author]);
+ DI::logger()->info('Item is not public, participation is ignored', ['parent_guid' => $parent_guid, 'guid' => $guid, 'author' => $author]);
return false;
}
try {
$author_url = (string)DI::dsprContact()->getByAddr($author)->url;
} catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
- Logger::notice('unable to find author details', ['author' => $author->getAddr()]);
+ DI::logger()->notice('unable to find author details', ['author' => $author->getAddr()]);
return false;
}
$datarray['changed'] = $datarray['created'] = $datarray['edited'] = DateTimeFormat::utcNow();
if (DI::contentItem()->isTooOld($datarray['created'], $datarray['uid'])) {
- Logger::info('Participation is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
+ DI::logger()->info('Participation is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
return false;
}
$message_id = Item::insert($datarray);
- Logger::info('Participation stored', ['id' => $message_id, 'guid' => $guid, 'parent_guid' => $parent_guid, 'author' => $author]);
+ DI::logger()->info('Participation stored', ['id' => $message_id, 'guid' => $guid, 'parent_guid' => $parent_guid, 'author' => $author]);
// Send all existing comments and likes to the requesting server
$comments = Post::select(
);
while ($comment = Post::fetch($comments)) {
if (($comment['gravity'] == Item::GRAVITY_ACTIVITY) && !in_array($comment['verb'], [Activity::LIKE, Activity::DISLIKE])) {
- Logger::info('Unsupported activities are not relayed', ['item' => $comment['id'], 'verb' => $comment['verb']]);
+ DI::logger()->info('Unsupported activities are not relayed', ['item' => $comment['id'], 'verb' => $comment['verb']]);
continue;
}
if ($comment['author-network'] == Protocol::ACTIVITYPUB) {
- Logger::info('Comments from ActivityPub authors are not relayed', ['item' => $comment['id']]);
+ DI::logger()->info('Comments from ActivityPub authors are not relayed', ['item' => $comment['id']]);
continue;
}
if ($comment['parent-author-network'] == Protocol::ACTIVITYPUB) {
- Logger::info('Comments to comments from ActivityPub authors are not relayed', ['item' => $comment['id']]);
+ DI::logger()->info('Comments to comments from ActivityPub authors are not relayed', ['item' => $comment['id']]);
continue;
}
- Logger::info('Deliver participation', ['item' => $comment['id'], 'contact' => $author_contact['cid']]);
+ DI::logger()->info('Deliver participation', ['item' => $comment['id'], 'contact' => $author_contact['cid']]);
if (Worker::add(Worker::PRIORITY_HIGH, 'Delivery', Delivery::POST, $comment['uri-id'], $author_contact['cid'], $datarray['uid'])) {
Post\DeliveryData::incrementQueueCount($comment['uri-id'], 1);
}
Contact::update($fields, ['id' => $contact['id']]);
- Logger::info('Profile of contact ' . $contact['id'] . ' stored for user ' . $importer['uid']);
+ DI::logger()->info('Profile of contact ' . $contact['id'] . ' stored for user ' . $importer['uid']);
return true;
}
// That makes us friends.
if ($contact) {
if ($following) {
- Logger::info('Author ' . $author . ' (Contact ' . $contact['id'] . ') wants to follow us.');
+ DI::logger()->info('Author ' . $author . ' (Contact ' . $contact['id'] . ') wants to follow us.');
self::receiveRequestMakeFriend($importer, $contact);
// refetch the contact array
if (in_array($contact['rel'], [Contact::FRIEND])) {
$user = DBA::selectFirst('user', [], ['uid' => $importer['uid']]);
if (DBA::isResult($user)) {
- Logger::info('Sending share message to author ' . $author . ' - Contact: ' . $contact['id'] . ' - User: ' . $importer['uid']);
+ DI::logger()->info('Sending share message to author ' . $author . ' - Contact: ' . $contact['id'] . ' - User: ' . $importer['uid']);
self::sendShare($user, $contact);
}
}
return true;
} else {
- Logger::info("Author " . $author . " doesn't want to follow us anymore.");
+ DI::logger()->info("Author " . $author . " doesn't want to follow us anymore.");
Contact::removeFollower($contact);
return true;
}
}
if (!$following && $sharing && in_array($importer['page-flags'], [User::PAGE_FLAGS_SOAPBOX, User::PAGE_FLAGS_NORMAL])) {
- Logger::info("Author " . $author . " wants to share with us - but doesn't want to listen. Request is ignored.");
+ DI::logger()->info("Author " . $author . " wants to share with us - but doesn't want to listen. Request is ignored.");
return false;
} elseif (!$following && !$sharing) {
- Logger::info("Author " . $author . " doesn't want anything - and we don't know the author. Request is ignored.");
+ DI::logger()->info("Author " . $author . " doesn't want anything - and we don't know the author. Request is ignored.");
return false;
} elseif (!$following && $sharing) {
- Logger::info("Author " . $author . " wants to share with us.");
+ DI::logger()->info("Author " . $author . " wants to share with us.");
} elseif ($following && $sharing) {
- Logger::info("Author " . $author . " wants to have a bidirectional connection.");
+ DI::logger()->info("Author " . $author . " wants to have a bidirectional connection.");
} elseif ($following && !$sharing) {
- Logger::info("Author " . $author . " wants to listen to us.");
+ DI::logger()->info("Author " . $author . " wants to listen to us.");
}
try {
$author_url = (string)DI::dsprContact()->getByAddr($author)->url;
} catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
- Logger::notice('Cannot resolve diaspora handle for recipient', ['author' => $author->getAddr(), 'recipient' => $recipient]);
+ DI::logger()->notice('Cannot resolve diaspora handle for recipient', ['author' => $author->getAddr(), 'recipient' => $recipient]);
return false;
}
if ($result === true) {
$contact_record = self::contactByHandle($importer['uid'], $author);
if (!$contact_record) {
- Logger::info('unable to locate newly created contact record.');
+ DI::logger()->info('unable to locate newly created contact record.');
return false;
}
self::fetchGuid($datarray);
if (DI::contentItem()->isTooOld($datarray['created'], $datarray['uid'])) {
- Logger::info('Reshare is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
+ DI::logger()->info('Reshare is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
return false;
}
self::sendParticipation($contact, $datarray);
if ($message_id) {
- Logger::info('Stored reshare ' . $datarray['guid'] . ' with message id ' . $message_id);
+ DI::logger()->info('Stored reshare ' . $datarray['guid'] . ' with message id ' . $message_id);
if ($datarray['uid'] == 0) {
Item::distribute($message_id);
}
$shared_item = Post::selectFirst(['uri-id'], ['guid' => $guid, 'uid' => [$uid, 0], 'private' => [Item::PUBLIC, Item::UNLISTED]]);
if (!DBA::isResult($shared_item) && !empty($host) && Diaspora::storeByGuid($guid, $host, true)) {
- Logger::debug('Fetched post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
+ DI::logger()->debug('Fetched post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
$shared_item = Post::selectFirst(['uri-id'], ['guid' => $guid, 'uid' => [$uid, 0], 'private' => [Item::PUBLIC, Item::UNLISTED]]);
} elseif (DBA::isResult($shared_item)) {
- Logger::debug('Found existing post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
+ DI::logger()->debug('Found existing post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
}
if (!DBA::isResult($shared_item)) {
- Logger::notice('Post does not exist.', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
+ DI::logger()->notice('Post does not exist.', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
return 0;
}
try {
$author = DI::dsprContact()->getByAddr($author_uri);
} catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
- Logger::notice('Unable to find details for author', ['author' => $author_uri->getAddr()]);
+ DI::logger()->notice('Unable to find details for author', ['author' => $author_uri->getAddr()]);
return false;
}
$r = Post::select($fields, $condition);
if (!DBA::isResult($r)) {
- Logger::notice('Target guid ' . $target_guid . ' was not found on this system for user ' . $importer['uid'] . '.');
+ DI::logger()->notice('Target guid ' . $target_guid . ' was not found on this system for user ' . $importer['uid'] . '.');
return false;
}
while ($item = Post::fetch($r)) {
if (DBA::exists('post-category', ['uri-id' => $item['uri-id'], 'uid' => $item['uid'], 'type' => Post\Category::FILE])) {
- Logger::info("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.");
+ DI::logger()->info("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.");
continue;
}
// Only delete it if the parent author really fits
if (!Strings::compareLink($parent['author-link'], $contact_url) && !Strings::compareLink($item['author-link'], $contact_url)) {
- Logger::info("Thread author " . $parent['author-link'] . " and item author " . $item['author-link'] . " don't fit to expected contact " . $contact_url);
+ DI::logger()->info("Thread author " . $parent['author-link'] . " and item author " . $item['author-link'] . " don't fit to expected contact " . $contact_url);
continue;
}
Item::markForDeletion(['id' => $item['id']]);
- Logger::info('Deleted target ' . $target_guid . ' (' . $item['id'] . ') from user ' . $item['uid'] . ' parent: ' . $item['parent']);
+ DI::logger()->info('Deleted target ' . $target_guid . ' (' . $item['id'] . ') from user ' . $item['uid'] . ' parent: ' . $item['parent']);
}
DBA::close($r);
$contact = self::contactByHandle($importer['uid'], $sender);
if (!$contact && (in_array($target_type, ['Contact', 'Person']))) {
- Logger::notice('Cannot find contact for sender: ' . $sender . ' and user ' . $importer['uid']);
+ DI::logger()->notice('Cannot find contact for sender: ' . $sender . ' and user ' . $importer['uid']);
return false;
}
$contact = [];
}
- Logger::info('Got retraction for ' . $target_type . ', sender ' . $sender . ' and user ' . $importer['uid']);
+ DI::logger()->info('Got retraction for ' . $target_type . ', sender ' . $sender . ' and user ' . $importer['uid']);
switch ($target_type) {
case 'Comment':
break;
default:
- Logger::notice('Unknown target type ' . $target_type);
+ DI::logger()->notice('Unknown target type ' . $target_type);
return false;
}
return true;
{
$contact = Contact::getByURL($author);
if (DBA::exists('contact', ['`nurl` = ? AND `uid` != ? AND `rel` IN (?, ?)', $contact['nurl'], 0, Contact::FRIEND, Contact::SHARING])) {
- Logger::debug('Author has got followers - accepted', ['uri-id' => $item['uri-id'], 'guid' => $item['guid'], 'url' => $item['uri'], 'author' => $author]);
+ DI::logger()->debug('Author has got followers - accepted', ['uri-id' => $item['uri-id'], 'guid' => $item['guid'], 'url' => $item['uri'], 'author' => $author]);
return true;
}
if ($direction == self::FORCED_FETCH) {
- Logger::debug('Post is a forced fetch - accepted', ['uri-id' => $item['uri-id'], 'guid' => $item['guid'], 'url' => $item['uri'], 'author' => $author]);
+ DI::logger()->debug('Post is a forced fetch - accepted', ['uri-id' => $item['uri-id'], 'guid' => $item['guid'], 'url' => $item['uri'], 'author' => $author]);
return true;
}
$tags = array_column(Tag::getByURIId($item['uri-id'], [Tag::HASHTAG]), 'name');
if (Relay::isSolicitedPost($tags, $body, $contact['id'], $item['uri'], Protocol::DIASPORA)) {
- Logger::debug('Post is accepted because of the relay settings', ['uri-id' => $item['uri-id'], 'guid' => $item['guid'], 'url' => $item['uri'], 'author' => $author]);
+ DI::logger()->debug('Post is accepted because of the relay settings', ['uri-id' => $item['uri-id'], 'guid' => $item['guid'], 'url' => $item['uri'], 'author' => $author]);
return true;
} else {
return false;
private static function storePhotoAsMedia(int $uriid, $photo)
{
// @TODO Need to find object type, roland@f.haeder.net
- Logger::debug('photo=' . get_class($photo));
+ DI::logger()->debug('photo=' . get_class($photo));
$data = [
'uri-id' => $uriid,
'type' => Post\Media::IMAGE,
self::fetchGuid($datarray);
if (DI::contentItem()->isTooOld($datarray['created'], $datarray['uid'])) {
- Logger::info('Status is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
+ DI::logger()->info('Status is too old', ['created' => $datarray['created'], 'uid' => $datarray['uid'], 'guid' => $datarray['guid']]);
return false;
}
self::sendParticipation($contact, $datarray);
if ($message_id) {
- Logger::info('Stored item ' . $datarray['guid'] . ' with message id ' . $message_id);
+ DI::logger()->info('Stored item ' . $datarray['guid'] . ' with message id ' . $message_id);
if ($datarray['uid'] == 0) {
Item::distribute($message_id);
}
*/
public static function encodePrivateData(string $msg, array $user, array $contact, string $prvkey, string $pubkey): string
{
- Logger::debug('Message: ' . $msg);
+ DI::logger()->debug('Message: ' . $msg);
// without a public key nothing will work
if (!$pubkey) {
- Logger::notice('pubkey missing: contact id: ' . $contact['id']);
+ DI::logger()->notice('pubkey missing: contact id: ' . $contact['id']);
return false;
}
}
if (!$dest_url) {
- Logger::notice('No URL for contact: ' . $contact['id'] . ' batch mode =' . $public_batch);
+ DI::logger()->notice('No URL for contact: ' . $contact['id'] . ' batch mode =' . $public_batch);
return 0;
}
- Logger::info('transmit: ' . $logid . '-' . $guid . ' ' . $dest_url);
+ DI::logger()->info('transmit: ' . $logid . '-' . $guid . ' ' . $dest_url);
if (!intval(DI::config()->get('system', 'diaspora_test'))) {
$content_type = (($public_batch) ? 'application/magic-envelope+xml' : 'application/json');
try {
$postResult = DI::httpClient()->post($dest_url . '/', $envelope, ['Content-Type' => $content_type], 0, HttpClientRequest::DIASPORA);
} catch (\Throwable $th) {
- Logger::notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
+ DI::logger()->notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
return 0;
}
$return_code = $postResult->getReturnCode();
} else {
- Logger::notice('test_mode');
+ DI::logger()->notice('test_mode');
return 200;
}
GServer::setReachableById($contact['gsid'], Protocol::DIASPORA);
}
- Logger::info('transmit: ' . $logid . '-' . $guid . ' to ' . $dest_url . ' returns: ' . $return_code);
+ DI::logger()->info('transmit: ' . $logid . '-' . $guid . ' to ' . $dest_url . ' returns: ' . $return_code);
return $return_code ? $return_code : -1;
}
// The "addr" field should always be filled.
// If this isn't the case, it will raise a notice some lines later.
// And in the log we will see where it came from, and we can handle it there.
- Logger::notice('Empty addr', ['contact' => $contact]);
+ DI::logger()->notice('Empty addr', ['contact' => $contact]);
}
$envelope = self::buildMessage($msg, $owner, $contact, $owner['uprvkey'], $pubkey ?? '', $public_batch);
$return_code = self::transmit($contact, $envelope, $public_batch, $guid);
- Logger::info('Transmitted message', ['owner' => $owner['uid'], 'target' => $contact['addr'], 'type' => $type, 'guid' => $guid, 'result' => $return_code]);
+ DI::logger()->info('Transmitted message', ['owner' => $owner['uid'], 'target' => $contact['addr'], 'type' => $type, 'guid' => $guid, 'result' => $return_code]);
return $return_code;
}
'parent_guid' => $item['guid']
];
- Logger::info('Send participation for ' . $item['guid'] . ' by ' . $author_handle);
+ DI::logger()->info('Send participation for ' . $item['guid'] . ' by ' . $author_handle);
// It doesn't matter what we store, we only want to avoid sending repeated notifications for the same item
DI::cache()->set($cachekey, $item['guid'], Duration::QUARTER_HOUR);
'signature' => $signature
];
- Logger::info('Send account migration', ['msg' => $message]);
+ DI::logger()->info('Send account migration', ['msg' => $message]);
return self::buildAndTransmit($owner, $contact, 'account_migration', $message);
}
'sharing' => 'true'
];
- Logger::info('Send share', ['msg' => $message]);
+ DI::logger()->info('Send share', ['msg' => $message]);
return self::buildAndTransmit($owner, $contact, 'contact', $message);
}
'sharing' => 'false'
];
- Logger::info('Send unshare', ['msg' => $message]);
+ DI::logger()->info('Send unshare', ['msg' => $message]);
return self::buildAndTransmit($owner, $contact, 'contact', $message);
}
$attend_answer = 'tentative';
break;
default:
- Logger::warning('Unknown verb ' . $item['verb'] . ' in item ' . $item['guid']);
+ DI::logger()->warning('Unknown verb ' . $item['verb'] . ' in item ' . $item['guid']);
return false;
}
$toplevel_item = Post::selectFirst(['guid', 'author-id', 'author-link', 'gravity'], ['id' => $item['parent'], 'parent' => $item['parent']]);
if (!DBA::isResult($toplevel_item)) {
- Logger::error('Missing parent conversation item', ['parent' => $item['parent']]);
+ DI::logger()->error('Missing parent conversation item', ['parent' => $item['parent']]);
return false;
}
$type = 'comment';
}
- Logger::info('Got relayable data ' . $type . ' for item ' . $item['guid'] . ' (' . $item['id'] . ')');
+ DI::logger()->info('Got relayable data ' . $type . ' for item ' . $item['guid'] . ' (' . $item['id'] . ')');
$msg = json_decode($item['signed_text'] ?? '', true);
$message[$field] = $data;
}
} else {
- Logger::info('Signature text for item ' . $item['guid'] . ' (' . $item['id'] . ') could not be extracted: ' . $item['signed_text']);
+ DI::logger()->info('Signature text for item ' . $item['guid'] . ' (' . $item['id'] . ') could not be extracted: ' . $item['signed_text']);
}
$message['parent_author_signature'] = self::signature($owner, $message);
- Logger::info('Relayed data', ['msg' => $message]);
+ DI::logger()->info('Relayed data', ['msg' => $message]);
return self::buildAndTransmit($owner, $contact, $type, $message, $public_batch, $item['guid']);
}
'target_type' => $target_type
];
- Logger::info('Got message', ['msg' => $message]);
+ DI::logger()->info('Got message', ['msg' => $message]);
return self::buildAndTransmit($owner, $contact, $msg_type, $message, $public_batch, $item['guid']);
}
$cnv = DBA::selectFirst('conv', [], ['id' => $item['convid'], 'uid' => $item['uid']]);
if (!DBA::isResult($cnv)) {
- Logger::notice('Conversation not found.');
+ DI::logger()->notice('Conversation not found.');
return -1;
}
public static function sendProfile(int $uid, array $recipients = [])
{
if (!$uid) {
- Logger::warning('Parameter "uid" is empty');
+ DI::logger()->warning('Parameter "uid" is empty');
return;
}
$owner = User::getOwnerDataById($uid);
if (empty($owner)) {
- Logger::warning('Cannot fetch User record', ['uid' => $uid]);
+ DI::logger()->warning('Cannot fetch User record', ['uid' => $uid]);
return;
}
if (empty($recipients)) {
- Logger::debug('No recipients provided, fetching for user', ['uid' => $uid]);
+ DI::logger()->debug('No recipients provided, fetching for user', ['uid' => $uid]);
$recipients = DBA::selectToArray('contact', [], ['network' => Protocol::DIASPORA, 'uid' => $uid, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]]);
}
if (empty($recipients)) {
- Logger::warning('Cannot fetch recipients', ['uid' => $uid]);
+ DI::logger()->warning('Cannot fetch recipients', ['uid' => $uid]);
return;
}
// @todo Split this into single worker jobs
foreach ($recipients as $recipient) {
if ((empty($recipient['gsid']) || GServer::isReachableById($recipient['gsid'])) && !Contact\User::isBlocked($recipient['id'], $uid)) {
- Logger::info('Send updated profile data for user ' . $uid . ' to contact ' . $recipient['id']);
+ DI::logger()->info('Send updated profile data for user ' . $uid . ' to contact ' . $recipient['id']);
self::buildAndTransmit($owner, $recipient, 'profile', $message);
}
}
{
$owner = User::getOwnerDataById($uid);
if (empty($owner)) {
- Logger::info('No owner post, so not storing signature', ['uid' => $uid]);
+ DI::logger()->info('No owner post, so not storing signature', ['uid' => $uid]);
return false;
}
if (!in_array($item['verb'], [Activity::LIKE, Activity::DISLIKE])) {
- Logger::warning('Item is neither a like nor a dislike', ['uid' => $uid, 'item[verb]' => $item['verb']]);;
+ DI::logger()->warning('Item is neither a like nor a dislike', ['uid' => $uid, 'item[verb]' => $item['verb']]);;
return false;
}
} else {
$contact = Contact::getById($item['author-id'], ['url']);
if (empty($contact['url'])) {
- Logger::warning('Author Contact not found', ['author-id' => $item['author-id']]);
+ DI::logger()->warning('Author Contact not found', ['author-id' => $item['author-id']]);
return false;
}
$url = $contact['url'];
$uid = User::getIdForURL($url);
if (empty($uid)) {
- Logger::info('No owner post, so not storing signature', ['url' => $contact['url'] ?? 'No contact loaded']);
+ DI::logger()->info('No owner post, so not storing signature', ['url' => $contact['url'] ?? 'No contact loaded']);
return false;
}
$owner = User::getOwnerDataById($uid);
if (empty($owner)) {
- Logger::info('No owner post, so not storing signature');
+ DI::logger()->info('No owner post, so not storing signature');
return false;
}
}
if (!self::parentSupportDiaspora($item['thr-parent-id'], $uid)) {
- Logger::info('One of the parents does not support Diaspora. A signature will not be created.', ['uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+ DI::logger()->info('One of the parents does not support Diaspora. A signature will not be created.', ['uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
return false;
}
{
$parent_post = Post::selectFirst(['gravity', 'signed_text', 'author-link', 'thr-parent-id', 'protocol'], ['uri-id' => $parent_id, 'uid' => [0, $uid]]);
if (empty($parent_post['thr-parent-id'])) {
- Logger::warning('Parent post does not exist.', ['parent-id' => $parent_id]);
+ DI::logger()->warning('Parent post does not exist.', ['parent-id' => $parent_id]);
return false;
}
if (!self::isSupportedByContactUrl($parent_post['author-link'])) {
- Logger::info('Parent author is no Diaspora contact.', ['parent-id' => $parent_id]);
+ DI::logger()->info('Parent author is no Diaspora contact.', ['parent-id' => $parent_id]);
return false;
}
if (($parent_post['protocol'] != Conversation::PARCEL_DIASPORA) && ($parent_post['gravity'] == Item::GRAVITY_COMMENT) && empty($parent_post['signed_text'])) {
- Logger::info('Parent comment has got no Diaspora signature.', ['parent-id' => $parent_id]);
+ DI::logger()->info('Parent comment has got no Diaspora signature.', ['parent-id' => $parent_id]);
return false;
}