]> git.mxchange.org Git - friendica-addons.git/commitdiff
The priority is now a class constant
authorMichael <heluecht@pirati.ca>
Mon, 17 Oct 2022 05:50:23 +0000 (05:50 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 17 Oct 2022 05:50:23 +0000 (05:50 +0000)
ifttt/ifttt.php
mailstream/mailstream.php
pumpio/pumpio.php
twitter/twitter.php

index 7154178a8b44c8b2926c12fc9d92a16594bb8a68..9ad1600786a67437dc1068daec1e31aa9a81de7b 100644 (file)
@@ -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);
 }
index 8c6e2693b7487a5e1fd0a3d07103dcd8045be035..a7d1dec5c4c63143767a19685a372cbf560794ab 100644 (file)
@@ -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`');
 }
index eacc394b7e4fa5d0baa33459796ae199f7eb5072..a88b0d3251407fa354d57f4041cc48878b5e1294 100644 (file)
@@ -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);
        }
 }
index 550f9dad53d199b52f754a7c9ef3652d7d279d09..a4acb3f1660800ccf147614eabba31c81f11c877 100644 (file)
@@ -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;
                                }
                        }