From 347803fd5c0b7ceb910535ac99dbfe1a88844fc1 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 4 Apr 2017 19:48:13 +0200 Subject: [PATCH] added spaces + some curly braces + some usage of dbm::is_result() Signed-off-by: Roland Haeder --- include/pgettext.php | 1 - include/queue.php | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/include/pgettext.php b/include/pgettext.php index 756905a43a..f6f26a8cc4 100644 --- a/include/pgettext.php +++ b/include/pgettext.php @@ -91,7 +91,6 @@ function pop_lang() { $lang = $a->langsave; } - // l if (! function_exists('load_translation_table')) { diff --git a/include/queue.php b/include/queue.php index dbed460473..3b34ada7f4 100644 --- a/include/queue.php +++ b/include/queue.php @@ -2,15 +2,15 @@ use Friendica\Core\Config; -require_once('include/queue_fn.php'); -require_once('include/dfrn.php'); -require_once("include/datetime.php"); -require_once('include/items.php'); -require_once('include/bbcode.php'); -require_once('include/socgraph.php'); -require_once('include/cache.php'); +require_once 'include/queue_fn.php'; +require_once 'include/dfrn.php'; +require_once 'include/datetime.php'; +require_once 'include/items.php'; +require_once 'include/bbcode.php'; +require_once 'include/socgraph.php'; +require_once 'include/cache.php'; -function queue_run(&$argv, &$argc){ +function queue_run(&$argv, &$argc) { global $a; if ($argc > 1) { @@ -29,6 +29,25 @@ function queue_run(&$argv, &$argc){ // Handling the pubsubhubbub requests proc_run(PRIORITY_HIGH,'include/pubsubpublish.php'); + $interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval'))); + + // If we are using the worker we don't need a delivery interval + /// @TODO To much get_config() here + if (get_config("system", "worker")) { + $interval = false; + } + + $r = q("select * from deliverq where 1"); + if ($r) { + foreach ($r as $rr) { + logger('queue: deliverq'); + proc_run(PRIORITY_HIGH,'include/delivery.php',$rr['cmd'],$rr['item'],$rr['contact']); + if ($interval) { + time_sleep_until(microtime(true) + (float) $interval); + } + } + } + $r = q("SELECT `queue`.*, `contact`.`name`, `contact`.`uid` FROM `queue` INNER JOIN `contact` ON `queue`.`cid` = `contact`.`id` WHERE `queue`.`created` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); @@ -60,8 +79,8 @@ function queue_run(&$argv, &$argc){ // delivering - require_once('include/salmon.php'); - require_once('include/diaspora.php'); + require_once 'include/salmon.php'; + require_once 'include/diaspora.php'; $r = q("SELECT * FROM `queue` WHERE `id` = %d LIMIT 1", intval($queue_id));