From e5842e83c793037d1b2b600856a7099b2e5160a0 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 17 Oct 2022 05:50:23 +0000 Subject: [PATCH] The priority is now a class constant --- ifttt/ifttt.php | 3 ++- mailstream/mailstream.php | 10 +++++----- pumpio/pumpio.php | 4 ++-- twitter/twitter.php | 8 ++++---- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 7154178a..9ad16007 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -12,6 +12,7 @@ use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Renderer; +use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Item; @@ -183,5 +184,5 @@ function ifttt_message($uid, $item) $link = hash('ripemd128', $item['msg']); } - Post\Delayed::add($link, $post, PRIORITY_MEDIUM, Post\Delayed::UNPREPARED); + Post\Delayed::add($link, $post, Worker::PRIORITY_MEDIUM, Post\Delayed::UNPREPARED); } diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 8c6e2693..a7d1dec5 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -53,7 +53,7 @@ function mailstream_check_version() 'addon/mailstream/mailstream.php', 'mailstream_convert_table_entries' ); - Hook::fork(PRIORITY_LOW, 'mailstream_convert_table_entries'); + Hook::fork(Worker::PRIORITY_LOW, 'mailstream_convert_table_entries'); } } @@ -183,7 +183,7 @@ function mailstream_post_hook(App $a, array &$item) 'message_id' => $message_id, 'tries' => 0, ]; - Hook::fork(PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); + Hook::fork(Worker::PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); } /** @@ -197,7 +197,7 @@ function mailstream_post_hook(App $a, array &$item) * * @return array new value of the attachments table (results are also stored in the reference parameter) */ -function mailstream_do_images(arrat &$item, array &$attachments) +function mailstream_do_images(array &$item, array &$attachments) { if (!DI::pConfig()->get($item['uid'], 'mailstream', 'attachimg')) { return; @@ -439,7 +439,7 @@ function mailstream_send(string $message_id, array $item, array $user): bool * * @param string $text text to word wrap - modified in-place */ -function mailstream_html_wrap(string &$text): string +function mailstream_html_wrap(string &$text) { $lines = str_split($text, 200); for ($i = 0; $i < count($lines); $i++) { @@ -467,7 +467,7 @@ function mailstream_convert_table_entries() continue; } Logger::info('mailstream_convert_table_entries: convert item to workerqueue', $send_hook_data); - Hook::fork(PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); + Hook::fork(Worker::PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); } DBA::e('DROP TABLE `mailstream_item`'); } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index eacc394b..a88b0d32 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -694,7 +694,7 @@ function pumpio_sync(App $a) function pumpio_cron(App $a, $b) { - Worker::add(PRIORITY_MEDIUM, 'addon/pumpio/pumpio_sync.php'); + Worker::add(Worker::PRIORITY_MEDIUM, 'addon/pumpio/pumpio_sync.php'); } function pumpio_fetchtimeline(App $a, int $uid) @@ -1506,7 +1506,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) $post->object = $item; - Logger::notice('pumpio_fetchallcomments: posting comment ' . $post->object->id . ' ', $post); + Logger::notice('pumpio_fetchallcomments: posting comment ' . $post->object->id . ' ', json_decode(json_encode($post), true)); pumpio_dopost($a, $client, $uid, $self, $post, $own_id, false); } } diff --git a/twitter/twitter.php b/twitter/twitter.php index 550f9dad..a4acb3f1 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -986,7 +986,7 @@ function twitter_cron(App $a) $pconfigs = DBA::selectToArray('pconfig', [], ['cat' => 'twitter', 'k' => 'mirror_posts', 'v' => true]); foreach ($pconfigs as $rr) { Logger::notice('Fetching', ['user' => $rr['uid']]); - Worker::add(['priority' => PRIORITY_MEDIUM, 'force_priority' => true], 'addon/twitter/twitter_sync.php', 1, (int) $rr['uid']); + Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/twitter/twitter_sync.php', 1, (int) $rr['uid']); } $abandon_days = intval(DI::config()->get('system', 'account_abandon_days')); @@ -1006,7 +1006,7 @@ function twitter_cron(App $a) } Logger::notice('importing timeline', ['user' => $rr['uid']]); - Worker::add(['priority' => PRIORITY_MEDIUM, 'force_priority' => true], 'addon/twitter/twitter_sync.php', 2, (int) $rr['uid']); + Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/twitter/twitter_sync.php', 2, (int) $rr['uid']); /* // To-Do // check for new contacts once a day @@ -1333,7 +1333,7 @@ function twitter_fetchtimeline(App $a, int $uid): void Logger::info('Posting mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]); - Post\Delayed::add($mirrorpost['extid'], $mirrorpost, PRIORITY_MEDIUM, Post\Delayed::UNPREPARED); + Post\Delayed::add($mirrorpost['extid'], $mirrorpost, Worker::PRIORITY_MEDIUM, Post\Delayed::UNPREPARED); } } DI::pConfig()->set($uid, 'twitter', 'lastid', $lastid); @@ -2191,7 +2191,7 @@ function twitter_fetchhometimeline(App $a, int $uid): void if (empty($postarray['thr-parent'])) { $contact = DBA::selectFirst('contact', [], ['id' => $postarray['contact-id'], 'self' => false]); if (DBA::isResult($contact) && Item::isRemoteSelf($contact, $postarray)) { - $notify = PRIORITY_MEDIUM; + $notify = Worker::PRIORITY_MEDIUM; } } -- 2.39.5