From 4fbd0a46b58cae1f04059b1ab9b0df654940cba7 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 2 Dec 2020 00:05:03 +0000 Subject: [PATCH] Reducing parameter list --- src/Model/Post/Delayed.php | 10 ++++------ src/Protocol/Feed.php | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Model/Post/Delayed.php b/src/Model/Post/Delayed.php index 357a3e8aa9..963122b5b8 100644 --- a/src/Model/Post/Delayed.php +++ b/src/Model/Post/Delayed.php @@ -33,8 +33,6 @@ class Delayed /** * Insert a new delayed post * - * @param string $uri - * @param integer $uid * @param string $delayed * @param array $item * @param integer $notify @@ -42,16 +40,16 @@ class Delayed * @param array $attachments * @return bool insert success */ - public static function add(string $uri, int $uid, string $delayed, array $item, int $notify = 0, array $taglist = [], array $attachments = []) + public static function add(string $delayed, array $item, int $notify = 0, array $taglist = [], array $attachments = []) { - if (self::exists($uri)) { + if (empty($item['uri']) || empty($item['uid']) || self::exists($item['uri'])) { return false; } - Logger::notice('Adding post for delayed publishing', ['uid' => $uid, 'delayed' => $delayed, 'uri' => $uri]); + Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $item['uri']]); Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments); - return DBA::insert('delayed-post', ['uri' => $uri, 'uid' => $uid, 'delayed' => $delayed], Database::INSERT_IGNORE); + return DBA::insert('delayed-post', ['uri' => $item['uri'], 'uid' => $item['uid'], 'delayed' => $delayed], Database::INSERT_IGNORE); } /** diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 2d5fbff4f7..821de8c335 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -656,7 +656,7 @@ class Feed } $publish_at = date(DateTimeFormat::MYSQL, $publish_time); - Post\Delayed::add($item['uri'], $item['uid'], $publish_at, $posting['item'], $posting['notify'], $posting['taglist'], $posting['attachments']); + Post\Delayed::add($publish_at, $posting['item'], $posting['notify'], $posting['taglist'], $posting['attachments']); DI::pConfig()->set($item['uid'], 'system', 'last_publish', $next_publish); } }