From: Michael Date: Sat, 21 Dec 2019 18:57:00 +0000 (+0000) Subject: Renamed functions X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=537da657cca1460462f91d788857276e1c21a16d;p=friendica.git Renamed functions --- diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 356be46e44..6928cb8d79 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -38,11 +38,11 @@ class Cron // Fork the cron jobs in separate parts to avoid problems when one of them is crashing Hook::fork($a->queue['priority'], "cron"); - // run the process to discover global contacts in the background - Worker::add(PRIORITY_LOW, "DiscoverPoCo"); + // run the process to update server directories in the background + Worker::add(PRIORITY_LOW, 'UpdateServerDirectories'); // run the process to update locally stored global contacts in the background - Worker::add(PRIORITY_LOW, 'DiscoverContacts'); + Worker::add(PRIORITY_LOW, 'UpdateGContacts'); // Expire and remove user entries Worker::add(PRIORITY_MEDIUM, "CronJobs", "expire_and_remove_users"); @@ -73,7 +73,7 @@ class Cron // update nodeinfo data Worker::add(PRIORITY_LOW, "CronJobs", "nodeinfo"); - Worker::add(PRIORITY_LOW, 'UpdateServers'); + Worker::add(PRIORITY_LOW, 'UpdateGServers'); Worker::add(PRIORITY_LOW, 'UpdateSuggestions'); diff --git a/src/Worker/DiscoverContacts.php b/src/Worker/DiscoverContacts.php deleted file mode 100644 index 7af170b3b4..0000000000 --- a/src/Worker/DiscoverContacts.php +++ /dev/null @@ -1,81 +0,0 @@ - Protocol::PHANTOM], - ['nurl' => Strings::normaliseLink($contact['url'])]); - continue; - } - - if (in_array($urlparts['host'], ['twitter.com', 'identi.ca'])) { - $networks = ['twitter.com' => Protocol::TWITTER, 'identi.ca' => Protocol::PUMPIO]; - - DBA::update('gcontact', ['network' => $networks[$urlparts['host']]], - ['nurl' => Strings::normaliseLink($contact['url'])]); - continue; - } - - $server_url = Contact::getBasepath($contact['url']); - $force_update = false; - - if (!empty($contact['server_url'])) { - $force_update = (Strings::normaliseLink($contact['server_url']) != Strings::normaliseLink($server_url)); - - $server_url = $contact['server_url']; - } - - if ((empty($server_url) && ($contact['network'] == Protocol::FEED)) || $force_update || GServer::check($server_url, $contact['network'])) { - Logger::info('Check profile', ['profile' => $contact['url']]); - Worker::add(PRIORITY_LOW, 'UpdateGContact', $contact['url'], 'force'); - - if (++$checked > 100) { - return; - } - } else { - DBA::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()], - ['nurl' => Strings::normaliseLink($contact['url'])]); - } - - // Quit the loop after 3 minutes - if (time() > ($starttime + 180)) { - return; - } - } - } -} diff --git a/src/Worker/DiscoverPoCo.php b/src/Worker/DiscoverPoCo.php deleted file mode 100644 index 29b5d4f657..0000000000 --- a/src/Worker/DiscoverPoCo.php +++ /dev/null @@ -1,28 +0,0 @@ - Protocol::PHANTOM], + ['nurl' => Strings::normaliseLink($contact['url'])]); + continue; + } + + if (in_array($urlparts['host'], ['twitter.com', 'identi.ca'])) { + $networks = ['twitter.com' => Protocol::TWITTER, 'identi.ca' => Protocol::PUMPIO]; + + DBA::update('gcontact', ['network' => $networks[$urlparts['host']]], + ['nurl' => Strings::normaliseLink($contact['url'])]); + continue; + } + + $server_url = Contact::getBasepath($contact['url']); + $force_update = false; + + if (!empty($contact['server_url'])) { + $force_update = (Strings::normaliseLink($contact['server_url']) != Strings::normaliseLink($server_url)); + + $server_url = $contact['server_url']; + } + + if ((empty($server_url) && ($contact['network'] == Protocol::FEED)) || $force_update || GServer::check($server_url, $contact['network'])) { + Logger::info('Check profile', ['profile' => $contact['url']]); + Worker::add(PRIORITY_LOW, 'UpdateGContact', $contact['url'], 'force'); + + if (++$checked > 100) { + return; + } + } else { + DBA::update('gcontact', ['last_failure' => DateTimeFormat::utcNow()], + ['nurl' => Strings::normaliseLink($contact['url'])]); + } + + // Quit the loop after 3 minutes + if (time() > ($starttime + 180)) { + return; + } + } + } +} diff --git a/src/Worker/UpdateGServers.php b/src/Worker/UpdateGServers.php new file mode 100644 index 0000000000..a245c34fca --- /dev/null +++ b/src/Worker/UpdateGServers.php @@ -0,0 +1,40 @@ + $gserver['url']]); + + Worker::add(PRIORITY_LOW, 'UpdateGServer', $gserver['url']); + + if (++$updated > 250) { + return; + } + } + } +} diff --git a/src/Worker/UpdateServerDirectories.php b/src/Worker/UpdateServerDirectories.php new file mode 100644 index 0000000000..e1b12034ad --- /dev/null +++ b/src/Worker/UpdateServerDirectories.php @@ -0,0 +1,28 @@ + $gserver['url']]); - - Worker::add(PRIORITY_LOW, 'UpdateGServer', $gserver['url']); - - if (++$updated > 250) { - return; - } - } - } -}