]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/GProbe.php
Remove items more memory friendly
[friendica.git] / src / Worker / GProbe.php
index 5222fb61ccfdba1d7ac8eae3fe2c8fa000341f91..116ca207025d90cad7677b96cf8bb957d60bf2fa 100644 (file)
@@ -6,14 +6,12 @@
 namespace Friendica\Worker;
 
 use Friendica\Core\Cache;
-use Friendica\Core\Config;
-use Friendica\Database\DBM;
+use Friendica\Core\Protocol;
+use Friendica\Database\DBA;
 use Friendica\Model\GContact;
 use Friendica\Network\Probe;
 use Friendica\Protocol\PortableContact;
 
-require_once 'include/datetime.php';
-
 class GProbe {
        public static function execute($url = '')
        {
@@ -23,18 +21,18 @@ class GProbe {
 
                $r = q(
                        "SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
-                       dbesc(normalise_link($url))
+                       DBA::escape(normalise_link($url))
                );
 
                logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
 
-               if (!DBM::is_result($r)) {
+               if (!DBA::isResult($r)) {
                        // Is it a DDoS attempt?
                        $urlparts = parse_url($url);
 
                        $result = Cache::get("gprobe:".$urlparts["host"]);
                        if (!is_null($result)) {
-                               if (in_array($result["network"], [NETWORK_FEED, NETWORK_PHANTOM])) {
+                               if (in_array($result["network"], [Protocol::FEED, Protocol::PHANTOM])) {
                                        logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG);
                                        return;
                                }
@@ -46,18 +44,18 @@ class GProbe {
                                Cache::set("gprobe:".$urlparts["host"], $arr);
                        }
 
-                       if (!in_array($arr["network"], [NETWORK_FEED, NETWORK_PHANTOM])) {
+                       if (!in_array($arr["network"], [Protocol::FEED, Protocol::PHANTOM])) {
                                GContact::update($arr);
                        }
 
                        $r = q(
                                "SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
-                               dbesc(normalise_link($url))
+                               DBA::escape(normalise_link($url))
                        );
                }
-               if (DBM::is_result($r)) {
+               if (DBA::isResult($r)) {
                        // Check for accessibility and do a poco discovery
-                       if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN)) {
+                       if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == Protocol::DFRN)) {
                                PortableContact::loadWorker(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url']));
                        }
                }