Add logging for unexpected empty published key in activity

This commit is contained in:
Hypolite Petovan 2021-12-11 10:17:34 -05:00
parent affd2bfdb7
commit 13efe0eff0

View File

@ -26,6 +26,7 @@ use Friendica\Content\Text\HTML;
use Friendica\Content\Text\Markdown; use Friendica\Content\Text\Markdown;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\APContact; use Friendica\Model\APContact;
@ -287,6 +288,10 @@ class Processor
$item['uri'] = $activity['id']; $item['uri'] = $activity['id'];
if (empty($activity['published']) || empty($activity['updated'])) {
DI::logger()->notice('published or updated keys are empty for activity', ['activity' => $activity, 'callstack' => System::callstack(10)]);
}
$item['created'] = DateTimeFormat::utc($activity['published'] ?? 'now'); $item['created'] = DateTimeFormat::utc($activity['published'] ?? 'now');
$item['edited'] = DateTimeFormat::utc($activity['updated'] ?? 'now'); $item['edited'] = DateTimeFormat::utc($activity['updated'] ?? 'now');
$guid = $activity['sc:identifier'] ?: self::getGUIDByURL($item['uri']); $guid = $activity['sc:identifier'] ?: self::getGUIDByURL($item['uri']);