]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/GlobalContact.php
Add Contact Object
[friendica.git] / src / Model / GlobalContact.php
index dc62024bc4095120ca6f24aa11bb33bdc6c100bc..dc30c8b692453b0acda30a2550be895e9eacc770 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * @file src/Model/GlobalContact.php
  * @brief This file includes the GlobalContact class with directory related functions
@@ -8,8 +7,10 @@ namespace Friendica\Model;
 
 use Friendica\Core\Config;
 use Friendica\Core\System;
+use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 use Friendica\Network\Probe;
+use Friendica\Object\Profile;
 use Friendica\Protocol\PortableContact;
 use dba;
 use Exception;
@@ -169,7 +170,7 @@ class GlobalContact
                        $gcontact['url'] = self::cleanContactUrl($gcontact['url']);
                }
 
-               $alternate = poco_alternate_ostatus_url($gcontact['url']);
+               $alternate = PortableContact::alternateOStatusUrl($gcontact['url']);
 
                // The global contacts should contain the original picture, not the cached one
                if (($gcontact['generation'] != 1) && stristr(normalise_link($gcontact['photo']), normalise_link(System::baseUrl()."/photo/"))) {
@@ -223,7 +224,7 @@ class GlobalContact
                }
 
                if ((!isset($gcontact['network']) || !isset($gcontact['name']) || !isset($gcontact['addr']) || !isset($gcontact['photo']) || !isset($gcontact['server_url']) || $alternate)
-                       && poco_reachable($gcontact['url'], $gcontact['server_url'], $gcontact['network'], false)
+                       && PortableContact::reachable($gcontact['url'], $gcontact['server_url'], $gcontact['network'], false)
                ) {
                        $data = Probe::uri($gcontact['url']);
 
@@ -257,7 +258,7 @@ class GlobalContact
 
                if (!isset($gcontact['server_url'])) {
                        // We check the server url to be sure that it is a real one
-                       $server_url = poco_detect_server($gcontact['url']);
+                       $server_url = PortableContact::detectServer($gcontact['url']);
 
                        // We are now sure that it is a correct URL. So we use it in the future
                        if ($server_url != "") {
@@ -266,7 +267,7 @@ class GlobalContact
                }
 
                // The server URL doesn't seem to be valid, so we don't store it.
-               if (!poco_check_server($gcontact['server_url'], $gcontact['network'])) {
+               if (!PortableContact::checkServer($gcontact['server_url'], $gcontact['network'])) {
                        $gcontact['server_url'] = "";
                }
 
@@ -524,7 +525,7 @@ class GlobalContact
                                $j = json_decode($x);
                                if ($j->entries) {
                                        foreach ($j->entries as $entry) {
-                                               poco_check_server($entry->url);
+                                               PortableContact::checkServer($entry->url);
 
                                                $url = $entry->url . '/poco';
                                                if (! in_array($url, $done)) {
@@ -591,7 +592,7 @@ class GlobalContact
         */
        public static function fixAlternateContactAddress(&$contact)
        {
-               if (($contact["network"] == NETWORK_OSTATUS) && poco_alternate_ostatus_url($contact["url"])) {
+               if (($contact["network"] == NETWORK_OSTATUS) && PortableContact::alternateOStatusUrl($contact["url"])) {
                        $data = Probe::uri($contact["url"]);
                        if ($contact["network"] == NETWORK_OSTATUS) {
                                logger("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
@@ -688,7 +689,7 @@ class GlobalContact
 
                if ($doprobing) {
                        logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
-                       Worker::add(PRIORITY_LOW, 'gprobe', $contact["url"]);
+                       Worker::add(PRIORITY_LOW, 'GProbe', $contact["url"]);
                }
 
                return $gcontact_id;
@@ -924,7 +925,7 @@ class GlobalContact
         *
         * @param str $server Server address
         */
-       public static function gsFetchUsers($server)
+       public static function fetchGsUsers($server)
        {
                logger("Fetching users from GNU Social server ".$server, LOGGER_DEBUG);
 
@@ -980,7 +981,7 @@ class GlobalContact
         * @brief Asking GNU Social server on a regular base for their user data
         *
         */
-       public static function gsDiscover()
+       public static function discoverGsUsers()
        {
                $requery_days = intval(Config::get("system", "poco_requery_days"));
 
@@ -997,7 +998,7 @@ class GlobalContact
                }
 
                foreach ($r as $server) {
-                       self::gsFetchUsers($server["url"]);
+                       self::fetchGsUsers($server["url"]);
                        q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc($server["nurl"]));
                }
        }