proper split cronjob functions

This commit is contained in:
Philipp Holzer 2019-04-22 14:22:00 +02:00
parent 6056081d5a
commit 5233434d94
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
2 changed files with 8 additions and 11 deletions

View file

@ -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');
}
}

View file

@ -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':