X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fqueue.php;h=fb65d5c25bcbaf88e91815a98c2f9a11259a0473;hb=d28d2ff440efba47ad65cf28eab4be96e0ea05b2;hp=ff280cb53b006f90e6d5d000ef808fbd3626f607;hpb=1eb177235bafe63bd021e86a963b5d78f9bd0cd1;p=friendica.git diff --git a/include/queue.php b/include/queue.php index ff280cb53b..fb65d5c25b 100644 --- a/include/queue.php +++ b/include/queue.php @@ -1,20 +1,6 @@ set_baseurl(get_config('system','url')); + load_hooks(); + $deadguys = array(); logger('queue: start'); @@ -58,17 +49,26 @@ function queue_run($argv, $argc){ if(! count($r)){ return; } + + call_hooks('queue_predeliver', $a, $r); + + // delivery loop require_once('include/salmon.php'); foreach($r as $q_item) { - $qi = q("SELECT * FROM `queue` WHERE `id` = %d LIMIT 1", + + // queue_predeliver hooks may have changed the queue db details, + // so check again if this entry still needs processing + + $qi = q("SELECT * FROM `queue` WHERE `id` = %d AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ", intval($q_item['id']) ); if(! count($qi)) continue; + $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($qi[0]['cid']) ); @@ -121,7 +121,6 @@ function queue_run($argv, $argc){ } break; default: - $a = get_app(); $params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false); call_hooks('queue_deliver', $a, $params);