]> git.mxchange.org Git - friendica.git/blobdiff - include/delivery.php
Merge pull request #3906 from zeroadam/Global-Poco-#3878
[friendica.git] / include / delivery.php
index 05fba7985cd9bc41a90c21185569b7faa034da3c..7c5f4648c681fda5ca556b7877d67c2a16fb157c 100644 (file)
@@ -1,14 +1,15 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\System;
 use Friendica\Core\Config;
+use Friendica\Database\DBM;
+use Friendica\Protocol\Diaspora;
+use Friendica\Protocol\DFRN;
 
 require_once 'include/queue_fn.php';
 require_once 'include/html2plain.php';
-require_once 'include/probe.php';
-require_once 'include/diaspora.php';
 require_once 'include/ostatus.php';
-require_once 'include/dfrn.php';
 
 function delivery_run(&$argv, &$argc){
        global $a;
@@ -95,7 +96,7 @@ function delivery_run(&$argv, &$argc){
                                intval($item_id)
                        );
 
-                       if ((!dbm::is_result($r)) || (!intval($r[0]['parent']))) {
+                       if ((!DBM::is_result($r)) || (!intval($r[0]['parent']))) {
                                continue;
                        }
 
@@ -155,7 +156,7 @@ function delivery_run(&$argv, &$argc){
                        intval($uid)
                );
 
-               if (!dbm::is_result($r)) {
+               if (!DBM::is_result($r)) {
                        continue;
                }
 
@@ -226,7 +227,7 @@ function delivery_run(&$argv, &$argc){
                        intval($contact_id)
                );
 
-               if (dbm::is_result($r)) {
+               if (DBM::is_result($r)) {
                        $contact = $r[0];
                }
                if ($contact['self']) {
@@ -243,12 +244,12 @@ function delivery_run(&$argv, &$argc){
 
                                if ($mail) {
                                        $item['body'] = fix_private_photos($item['body'],$owner['uid'],null,$message[0]['contact-id']);
-                                       $atom = dfrn::mail($item, $owner);
+                                       $atom = DFRN::mail($item, $owner);
                                } elseif ($fsuggest) {
-                                       $atom = dfrn::fsuggest($item, $owner);
+                                       $atom = DFRN::fsuggest($item, $owner);
                                        q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id']));
                                } elseif ($relocate) {
-                                       $atom = dfrn::relocate($owner, $uid);
+                                       $atom = DFRN::relocate($owner, $uid);
                                } elseif ($followup) {
                                        $msgitems = array();
                                        foreach ($items as $item) {  // there is only one item
@@ -260,7 +261,7 @@ function delivery_run(&$argv, &$argc){
                                                        $msgitems[] = $item;
                                                }
                                        }
-                                       $atom = dfrn::entries($msgitems,$owner);
+                                       $atom = DFRN::entries($msgitems,$owner);
                                } else {
                                        $msgitems = array();
                                        foreach ($items as $item) {
@@ -289,7 +290,7 @@ function delivery_run(&$argv, &$argc){
                                                        $msgitems[] = $item;
                                                }
                                        }
-                                       $atom = dfrn::entries($msgitems,$owner);
+                                       $atom = DFRN::entries($msgitems,$owner);
                                }
 
                                logger('notifier entry: '.$contact["url"].' '.$target_item["guid"].' entry: '.$atom, LOGGER_DEBUG);
@@ -299,7 +300,7 @@ function delivery_run(&$argv, &$argc){
 
                                // perform local delivery if we are on the same site
 
-                               if (link_compare($basepath,App::get_baseurl())) {
+                               if (link_compare($basepath,System::baseUrl())) {
 
                                        $nickname = basename($contact['url']);
                                        if ($contact['issued-id']) {
@@ -334,7 +335,7 @@ function delivery_run(&$argv, &$argc){
                                                        $x[0]['writable'] = 1;
                                                }
 
-                                               $ssl_policy = get_config('system','ssl_policy');
+                                               $ssl_policy = Config::get('system','ssl_policy');
                                                fix_contact_ssl_policy($x[0],$ssl_policy);
 
                                                // If we are setup as a soapbox we aren't accepting top level posts from this person
@@ -343,13 +344,13 @@ function delivery_run(&$argv, &$argc){
                                                        break;
                                                }
                                                logger('mod-delivery: local delivery');
-                                               dfrn::import($atom, $x[0]);
+                                               DFRN::import($atom, $x[0]);
                                                break;
                                        }
                                }
 
                                if (!was_recently_delayed($contact['id'])) {
-                                       $deliver_status = dfrn::deliver($owner,$contact,$atom);
+                                       $deliver_status = DFRN::deliver($owner,$contact,$atom);
                                } else {
                                        $deliver_status = (-1);
                                }
@@ -374,7 +375,7 @@ function delivery_run(&$argv, &$argc){
                                if ($owner['prvnets']) {
                                        break;
                                }
-                               if (get_config('system','ostatus_disabled') || get_config('system','dfrn_only')) {
+                               if (Config::get('system','ostatus_disabled') || Config::get('system','dfrn_only')) {
                                        break;
                                }
 
@@ -385,7 +386,7 @@ function delivery_run(&$argv, &$argc){
                        case NETWORK_MAIL:
                        case NETWORK_MAIL2:
 
-                               if (get_config('system','dfrn_only')) {
+                               if (Config::get('system','dfrn_only')) {
                                        break;
                                }
                                // WARNING: does not currently convert to RFC2047 header encodings, etc.
@@ -405,7 +406,7 @@ function delivery_run(&$argv, &$argc){
                                                        intval($argv[2]),
                                                        intval($uid)
                                                );
-                                               if (dbm::is_result($r))
+                                               if (DBM::is_result($r))
                                                        $it = $r[0];
                                        }
                                        if (!$it)
@@ -462,14 +463,14 @@ function delivery_run(&$argv, &$argc){
                                                                dbesc($it['parent-uri']),
                                                                intval($uid));
 
-                                                       if (dbm::is_result($r) && ($r[0]['title'] != '')) {
+                                                       if (DBM::is_result($r) && ($r[0]['title'] != '')) {
                                                                $subject = $r[0]['title'];
                                                        } else {
                                                                $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
                                                                        dbesc($it['parent-uri']),
                                                                        intval($uid));
 
-                                                               if (dbm::is_result($r) && ($r[0]['title'] != ''))
+                                                               if (DBM::is_result($r) && ($r[0]['title'] != ''))
                                                                        $subject = $r[0]['title'];
                                                        }
                                                }
@@ -488,7 +489,7 @@ function delivery_run(&$argv, &$argc){
 
                                logger('delivery: diaspora batch deliver: '.$loc);
 
-                               if (get_config('system','dfrn_only') || (!get_config('system','diaspora_enabled')))
+                               if (Config::get('system','dfrn_only') || (!Config::get('system','diaspora_enabled')))
                                        break;
 
                                if ($mail) {
@@ -507,6 +508,9 @@ function delivery_run(&$argv, &$argc){
                                        logger('diaspora retract: '.$loc);
                                        Diaspora::send_retraction($target_item,$owner,$contact,$public_message);
                                        break;
+                               } elseif ($relocate) {
+                                       Diaspora::sendAccountMigration($owner, $contact, $uid);
+                                       break;
                                } elseif ($followup) {
                                        // send comments and likes to owner to relay
                                        logger('diaspora followup: '.$loc);