From 5233434d94c9b783755e7a5e43327d696761341b Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 22 Apr 2019 14:22:00 +0200 Subject: [PATCH] proper split cronjob functions --- src/Model/Nodeinfo.php | 11 ----------- src/Worker/CronJobs.php | 8 ++++++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Model/Nodeinfo.php b/src/Model/Nodeinfo.php index 560629b6a1..60eba2713a 100644 --- a/src/Model/Nodeinfo.php +++ b/src/Model/Nodeinfo.php @@ -5,7 +5,6 @@ namespace Friendica\Model; use Friendica\BaseObject; use Friendica\Core\Addon; use Friendica\Database\DBA; -use Friendica\Util\Network; /** * Model interaction for the nodeinfo @@ -46,8 +45,6 @@ class Nodeinfo extends BaseObject return; } - $logger->info('cron_start'); - $userStats = User::getStatistics(); $config->set('nodeinfo', 'total_users', $userStats['total_users']); @@ -63,13 +60,5 @@ class Nodeinfo extends BaseObject $local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]); $config->set('nodeinfo', 'local_comments', $local_comments); $logger->debug('item statistics', ['local_comments' => $local_comments]); - - // Now trying to register - $url = 'http://the-federation.info/register/' . $app->getHostName(); - $logger->debug('Check registering url', ['url' => $url]); - $ret = Network::fetchUrl($url); - $logger->debug('Check registering answer', ['answer' => $ret]); - - $logger->info('cron_end'); } } diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index 2618541ddb..ad971c8f32 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -21,6 +21,7 @@ use Friendica\Model\Photo; use Friendica\Model\User; use Friendica\Network\Probe; use Friendica\Protocol\PortableContact; +use Friendica\Util\Network; use Friendica\Util\Proxy as ProxyUtils; require_once 'mod/nodeinfo.php'; @@ -44,7 +45,14 @@ class CronJobs break; case 'nodeinfo': + Logger::info('cron_start'); Nodeinfo::update(); + // Now trying to register + $url = 'http://the-federation.info/register/' . $app->getHostName(); + Logger::debug('Check registering url', ['url' => $url]); + $ret = Network::fetchUrl($url); + Logger::debug('Check registering answer', ['answer' => $ret]); + Logger::info('cron_end'); break; case 'expire_and_remove_users': -- 2.39.5