X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FCronJobs.php;h=319a369d1fa69a6953059bedb954b81afe8199b2;hb=a98957eeb29cfb142dfc4cd3e03c5bdfbc373466;hp=b66358b0e820d140e5a8bd057f891d6843bf9603;hpb=13a10b8f20ac7c5927c39d9e80e1a7d515385736;p=friendica.git diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index b66358b0e8..319a369d1f 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -84,10 +84,6 @@ class CronJobs self::clearCache($a); break; - case 'repair_diaspora': - self::repairDiaspora($a); - break; - case 'repair_database': self::repairDatabase(); break; @@ -132,6 +128,7 @@ class CronJobs while ($user = DBA::fetch($users)) { User::remove($user['uid']); } + DBA::close($users); // delete user records for recently removed accounts $users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() "]); @@ -144,6 +141,7 @@ class CronJobs DBA::delete('user', ['uid' => $user['uid']]); } + DBA::close($users); } /** @@ -244,46 +242,6 @@ class CronJobs DI::config()->set('system', 'cache_last_cleared', time()); } - /** - * Repair missing values in Diaspora contacts - * - * @param App $a - * @throws \Friendica\Network\HTTPException\InternalServerErrorException - * @throws \ImagickException - */ - private static function repairDiaspora(App $a) - { - $starttime = time(); - - $r = q("SELECT `id`, `url` FROM `contact` - WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '') - ORDER BY RAND() LIMIT 50", DBA::escape(Protocol::DIASPORA)); - if (!DBA::isResult($r)) { - return; - } - - foreach ($r as $contact) { - // Quit the loop after 3 minutes - if (time() > ($starttime + 180)) { - return; - } - - if (!GServer::reachable($contact["url"])) { - continue; - } - - $data = Probe::uri($contact["url"]); - if ($data["network"] != Protocol::DIASPORA) { - continue; - } - - Logger::log("Repair contact " . $contact["id"] . " " . $contact["url"], Logger::DEBUG); - q("UPDATE `contact` SET `batch` = '%s', `notify` = '%s', `poll` = '%s', pubkey = '%s' WHERE `id` = %d", - DBA::escape($data["batch"]), DBA::escape($data["notify"]), DBA::escape($data["poll"]), DBA::escape($data["pubkey"]), - intval($contact["id"])); - } - } - /** * Do some repairs in database entries *