]> git.mxchange.org Git - friendica.git/blobdiff - include/delivery.php
Fix SQL date format bug in dfrn
[friendica.git] / include / delivery.php
index 8ccb19cedc187842e156d4efb919af46ead5cfae..faa1cad6745d45667f4a3e393006f92f6a06772d 100644 (file)
@@ -2,44 +2,25 @@
 
 use \Friendica\Core\Config;
 
-require_once("boot.php");
 require_once('include/queue_fn.php');
 require_once('include/html2plain.php');
-require_once("include/Scrape.php");
+require_once('include/Scrape.php');
 require_once('include/diaspora.php');
-require_once("include/ostatus.php");
-require_once("include/dfrn.php");
+require_once('include/ostatus.php');
+require_once('include/dfrn.php');
 
 function delivery_run(&$argv, &$argc){
-       global $a, $db;
+       global $a;
 
-       if (is_null($a)) {
-               $a = new App;
-       }
-
-       if (is_null($db)) {
-               @include(".htconfig.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("include/session.php");
-       require_once("include/datetime.php");
+       require_once('include/datetime.php');
        require_once('include/items.php');
        require_once('include/bbcode.php');
        require_once('include/email.php');
 
-       Config::load();
-
-       load_hooks();
-
        if ($argc < 3) {
                return;
        }
 
-       $a->set_baseurl(get_config('system','url'));
-
        logger('delivery: invoked: '. print_r($argv,true), LOGGER_DEBUG);
 
        $cmd        = $argv[1];
@@ -49,30 +30,6 @@ function delivery_run(&$argv, &$argc){
 
                $contact_id = intval($argv[$x]);
 
-               /// @todo When switching completely to the worker we won't need this anymore
-               // Some other process may have delivered this item already.
-
-               $r = q("SELECT * FROM `deliverq` WHERE `cmd` = '%s' AND `item` = %d AND `contact` = %d LIMIT 1",
-                       dbesc($cmd),
-                       dbesc($item_id),
-                       dbesc($contact_id)
-               );
-               if (!dbm::is_result($r)) {
-                       continue;
-               }
-
-               if ($a->maxload_reached()) {
-                       return;
-               }
-
-               // It's ours to deliver. Remove it from the queue.
-
-               q("DELETE FROM `deliverq` WHERE `cmd` = '%s' AND `item` = %d AND `contact` = %d",
-                       dbesc($cmd),
-                       dbesc($item_id),
-                       dbesc($contact_id)
-               );
-
                if (!$item_id || !$contact_id) {
                        continue;
                }
@@ -577,8 +534,3 @@ function delivery_run(&$argv, &$argc){
 
        return;
 }
-
-if (array_search(__file__,get_included_files())===0){
-  delivery_run($_SERVER["argv"],$_SERVER["argc"]);
-  killme();
-}