mirror of
https://github.com/friendica/friendica
synced 2024-11-13 17:02:54 +00:00
50da89d861
update logger levels in calls
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* @file src/Worker/APDelivery.php
|
|
*/
|
|
namespace Friendica\Worker;
|
|
|
|
use Friendica\BaseObject;
|
|
use Friendica\Core\Logger;
|
|
use Friendica\Core\Worker;
|
|
use Friendica\Protocol\ActivityPub;
|
|
use Friendica\Model\Item;
|
|
use Friendica\Util\HTTPSignature;
|
|
|
|
class APDelivery extends BaseObject
|
|
{
|
|
/**
|
|
* @brief Delivers ActivityPub messages
|
|
*
|
|
* @param string $cmd
|
|
* @param integer $item_id
|
|
* @param string $inbox
|
|
* @param integer $uid
|
|
*/
|
|
public static function execute($cmd, $item_id, $inbox, $uid)
|
|
{
|
|
Logger::log('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $inbox, Logger::DEBUG);
|
|
|
|
$success = true;
|
|
|
|
if ($cmd == Delivery::MAIL) {
|
|
} elseif ($cmd == Delivery::SUGGESTION) {
|
|
$success = ActivityPub\Transmitter::sendContactSuggestion($uid, $inbox, $item_id);
|
|
} elseif ($cmd == Delivery::RELOCATION) {
|
|
} elseif ($cmd == Delivery::REMOVAL) {
|
|
$success = ActivityPub\Transmitter::sendProfileDeletion($uid, $inbox);
|
|
} elseif ($cmd == Delivery::PROFILEUPDATE) {
|
|
$success = ActivityPub\Transmitter::sendProfileUpdate($uid, $inbox);
|
|
} else {
|
|
$data = ActivityPub\Transmitter::createCachedActivityFromItem($item_id);
|
|
if (!empty($data)) {
|
|
$success = HTTPSignature::transmit($data, $inbox, $uid);
|
|
}
|
|
}
|
|
|
|
if (!$success) {
|
|
Worker::defer();
|
|
}
|
|
}
|
|
}
|