Reducing parameter list

This commit is contained in:
Michael 2020-12-02 00:05:03 +00:00
parent b047d31a4f
commit 4fbd0a46b5
2 changed files with 5 additions and 7 deletions

View file

@ -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);
}
/**

View file

@ -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);
}
}