]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/DiscoverPoCo.php
Merge pull request #5439 from MrPetovan/task/5410-remove-dbesc
[friendica.git] / src / Worker / DiscoverPoCo.php
index c77830d60af7a19742dca670f951999bfccc9fbe..4b3474728ca23f1c790b78cbcb71901a175b9cb7 100644 (file)
@@ -7,13 +7,12 @@ namespace Friendica\Worker;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
-use Friendica\Database\DBM;
+use Friendica\Database\DBA;
 use Friendica\Model\GContact;
 use Friendica\Network\Probe;
 use Friendica\Protocol\PortableContact;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
-use dba;
 
 class DiscoverPoCo
 {
@@ -119,7 +118,7 @@ class DiscoverPoCo
        private static function updateServer() {
                $r = q("SELECT `url`, `created`, `last_failure`, `last_contact` FROM `gserver` ORDER BY rand()");
 
-               if (!DBM::is_result($r)) {
+               if (!DBA::isResult($r)) {
                        return;
                }
 
@@ -148,8 +147,8 @@ class DiscoverPoCo
                                WHERE `last_contact` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
                                        `last_failure` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
                                        `network` IN ('%s', '%s', '%s', '%s', '') ORDER BY rand()",
-                               dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA),
-                               dbesc(NETWORK_OSTATUS), dbesc(NETWORK_FEED));
+                               DBA::escape(NETWORK_DFRN), DBA::escape(NETWORK_DIASPORA),
+                               DBA::escape(NETWORK_OSTATUS), DBA::escape(NETWORK_FEED));
 
                if (!$users) {
                        return;
@@ -160,7 +159,7 @@ class DiscoverPoCo
 
                        $urlparts = parse_url($user["url"]);
                        if (!isset($urlparts["scheme"])) {
-                               dba::update('gcontact', ['network' => NETWORK_PHANTOM],
+                               DBA::update('gcontact', ['network' => NETWORK_PHANTOM],
                                        ['nurl' => normalise_link($user["url"])]);
                                continue;
                         }
@@ -173,7 +172,7 @@ class DiscoverPoCo
                                                "identi.ca" => NETWORK_PUMPIO,
                                                "alpha.app.net" => NETWORK_APPNET];
 
-                               dba::update('gcontact', ['network' => $networks[$urlparts["host"]]],
+                               DBA::update('gcontact', ['network' => $networks[$urlparts["host"]]],
                                        ['nurl' => normalise_link($user["url"])]);
                                continue;
                        }
@@ -196,7 +195,7 @@ class DiscoverPoCo
                                        return;
                                }
                        } else {
-                               dba::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
+                               DBA::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()],
                                        ['nurl' => normalise_link($user["url"])]);
                        }
 
@@ -225,7 +224,7 @@ class DiscoverPoCo
                        foreach ($j->results as $jj) {
                                // Check if the contact already exists
                                $exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url));
-                               if (DBM::is_result($exists)) {
+                               if (DBA::isResult($exists)) {
                                        logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG);
 
                                        if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) &&