X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FDelivery.php;h=9f8174e2d4e08a0ff6e5c87e88e3aa507150dbb2;hb=d27576059670faf87f80eaae2b4560f85b5310fc;hp=e35433b0c9227c899ffa051ad10951940912bdd5;hpb=1874a32728142f2c12724562eb122eb1cd1370fe;p=friendica.git diff --git a/src/Protocol/Delivery.php b/src/Protocol/Delivery.php index e35433b0c9..9f8174e2d4 100644 --- a/src/Protocol/Delivery.php +++ b/src/Protocol/Delivery.php @@ -161,7 +161,7 @@ class Delivery // if $parent['wall'] == 1 we will already have the parent message in our array // and we will relay the whole lot. - $localhost = DI::baseUrl()->getHostname(); + $localhost = DI::baseUrl()->getHost(); if (strpos($localhost, ':')) { $localhost = substr($localhost, 0, strpos($localhost, ':')); } @@ -404,7 +404,7 @@ class Delivery */ private static function deliverDiaspora(string $cmd, array $contact, array $owner, array $items, array $target_item, bool $public_message, bool $top_level, bool $followup): bool { - // We don't treat Forum posts as "wall-to-wall" to be able to post them via Diaspora + // We don't treat group posts as "wall-to-wall" to be able to post them via Diaspora $walltowall = $top_level && ($owner['id'] != $items[0]['contact-id']) & ($owner['account-type'] != User::ACCOUNT_TYPE_COMMUNITY); if ($public_message) { @@ -556,7 +556,7 @@ class Delivery $headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $local_user['email'] . '>' . "\n"; } } else { - $sender = DI::config()->get('config', 'sender_email', 'noreply@' . DI::baseUrl()->getHostname()); + $sender = DI::config()->get('config', 'sender_email', 'noreply@' . DI::baseUrl()->getHost()); $headers = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' <' . $sender . '>' . "\n"; } @@ -606,68 +606,4 @@ class Delivery } return $success; } - - /** - * Add post for a server - * - * @param string $cmd - * @param integer $uri_id - * @param string $created - * @param integer $cid - * @param integer $gsid - * @param integer $uid - * @return bool - */ - public static function addQueue(string $cmd, int $uri_id, string $created, int $cid, int $gsid, int $uid): bool - { - $fields = ['uri-id' => $uri_id, 'uid' => $uid, 'cid' => $cid, 'gsid' => $gsid, 'created' => $created, 'command' => $cmd]; - - return DBA::insert('delivery-queue', $fields, Database::INSERT_IGNORE); - } - - /** - * Remove post by a server after delivery - * - * @param integer $uri_id - * @param integer $gsid - * @return bool - */ - public static function removeQueue(int $uri_id, int $gsid): bool - { - return DBA::delete('delivery-queue', ['uri-id' => $uri_id, 'gsid' => $gsid]); - } - - /** - * Remove failed posts for the given server - * - * @param integer $gsid - * @return bool - */ - public static function removeFailedQueue(int $gsid): bool - { - return DBA::delete('delivery-queue', ["`gsid` = ? AND `failed` >= ?", $gsid, DI::config()->get('system', 'worker_defer_limit')]); - } - - /** - * Increment "failed" counter for the given server and post - * - * @param integer $uri_id - * @param integer $gsid - * @return bool - */ - public static function incrementFailedQueue(int $uri_id, int $gsid): bool - { - return DBA::e('UPDATE `delivery-queue` SET `failed` = `failed` + 1 WHERE `uri-id` = ? AND `gsid` = ?', $uri_id, $gsid); - } - - /** - * Select queue entries for the given server - * - * @param integer $gsid - * @return array - */ - public static function selectQueueForServer(int $gsid): array - { - return DBA::selectToArray('delivery-queue', [], ["`gsid` = ? AND `failed` < ?", $gsid, DI::config()->get('system', 'worker_defer_limit')], ['order' => ['created']]); - } }