]> git.mxchange.org Git - friendica.git/blobdiff - include/queue.php
Some added logging
[friendica.git] / include / queue.php
index 47a3596bdb46c31724724a766cc81c890a118d87..bcd32985db890d2ea1d36f3e495e2a9278f66ea5 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once('include/queue_fn.php');
 require_once('include/dfrn.php');
@@ -17,15 +20,13 @@ function queue_run(&$argv, &$argc){
                unset($db_host, $db_user, $db_pass, $db_data);
        };
 
-
        require_once("include/session.php");
        require_once("include/datetime.php");
        require_once('include/items.php');
        require_once('include/bbcode.php');
        require_once('include/socgraph.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run")
@@ -59,20 +60,21 @@ function queue_run(&$argv, &$argc){
                        $interval = false;
 
                $r = q("select * from deliverq where 1");
-               if($r) {
-                       foreach($r as $rr) {
+               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);
+                               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");
-               if($r) {
-                       foreach($r as $rr) {
+               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);
                        }
@@ -127,7 +129,7 @@ function queue_run(&$argv, &$argc){
                $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
                        intval($qi[0]['cid'])
                );
-               if(! count($c)) {
+               if (! dbm::is_result($c)) {
                        remove_queue_item($q_item['id']);
                        continue;
                }
@@ -157,7 +159,7 @@ function queue_run(&$argv, &$argc){
                        FROM `user` WHERE `uid` = %d LIMIT 1",
                        intval($c[0]['uid'])
                );
-               if(! count($u)) {
+               if (! dbm::is_result($u)) {
                        remove_queue_item($q_item['id']);
                        continue;
                }
@@ -196,7 +198,7 @@ function queue_run(&$argv, &$argc){
                        case NETWORK_DIASPORA:
                                if($contact['notify']) {
                                        logger('queue: diaspora_delivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>');
-                                       $deliver_status = diaspora::transmit($owner,$contact,$data,$public,true);
+                                       $deliver_status = Diaspora::transmit($owner,$contact,$data,$public,true);
 
                                        if($deliver_status == (-1)) {
                                                update_queue_time($q_item['id']);