X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fqueue.php;h=64cccad21efe4f796a50e39b480da75415da7d12;hb=39d8fec290613cac87c2821b9f7b20fa94d319ca;hp=5119a65d8cebaee58cbb8cd007d734541180203a;hpb=177e0e15d73fedd3c58a9d5f9cb7f509bd1da07b;p=friendica.git diff --git a/include/queue.php b/include/queue.php index 5119a65d8c..64cccad21e 100644 --- a/include/queue.php +++ b/include/queue.php @@ -2,7 +2,7 @@ require_once("boot.php"); require_once('include/queue_fn.php'); -function queue_run($argv, $argc){ +function queue_run(&$argv, &$argc){ global $a, $db; if(is_null($a)){ @@ -11,14 +11,14 @@ function queue_run($argv, $argc){ if(is_null($db)){ @include(".htconfig.php"); - require_once("dba.php"); + require_once("include/dba.php"); $db = new dba($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data); }; - require_once("session.php"); - require_once("datetime.php"); + require_once("include/session.php"); + require_once("include/datetime.php"); require_once('include/items.php'); require_once('include/bbcode.php'); @@ -41,7 +41,7 @@ function queue_run($argv, $argc){ $interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval'))); $r = q("select * from deliverq where 1"); - if(count($r)) { + if($r) { foreach($r as $rr) { logger('queue: deliverq'); proc_run('php','include/delivery.php',$rr['cmd'],$rr['item'],$rr['contact']); @@ -53,7 +53,7 @@ function queue_run($argv, $argc){ $r = q("SELECT `queue`.*, `contact`.`name`, `contact`.`uid` FROM `queue` LEFT JOIN `contact` ON `queue`.`cid` = `contact`.`id` WHERE `queue`.`created` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); - if(count($r)) { + if($r) { foreach($r as $rr) { logger('Removing expired queue item for ' . $rr['name'] . ', uid=' . $rr['uid']); logger('Expired queue data :' . $rr['content'], LOGGER_DATA); @@ -61,14 +61,19 @@ function queue_run($argv, $argc){ q("DELETE FROM `queue` WHERE `created` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); } - if($queue_id) + if($queue_id) { $r = q("SELECT `id` FROM `queue` WHERE `id` = %d LIMIT 1", intval($queue_id) ); - else - $r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE "); + } + else { - if(! count($r)){ + // For the first 12 hours we'll try to deliver every 15 minutes + // After that, we'll only attempt delivery once per hour. + + $r = q("SELECT `id` FROM `queue` WHERE (( `created` > UTC_TIMESTAMP() - INTERVAL 12 HOUR && `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ) OR ( `last` < UTC_TIMESTAMP() - INTERVAL 1 HOUR ))"); + } + if(! $r){ return; } @@ -123,6 +128,7 @@ function queue_run($argv, $argc){ } $data = $qi[0]['content']; + $public = $qi[0]['batch']; $contact = $c[0]; $owner = $u[0]; @@ -155,7 +161,7 @@ function queue_run($argv, $argc){ case NETWORK_DIASPORA: if($contact['notify']) { logger('queue: diaspora_delivery: item ' . $q_item['id'] . ' for ' . $contact['name']); - $deliver_status = diaspora_transmit($owner,$contact,$data); + $deliver_status = diaspora_transmit($owner,$contact,$data,$public,true); if($deliver_status == (-1)) update_queue_time($q_item['id']);