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\BaseObject;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Util\Network;
/** /**
* Model interaction for the nodeinfo * Model interaction for the nodeinfo
@ -46,8 +45,6 @@ class Nodeinfo extends BaseObject
return; return;
} }
$logger->info('cron_start');
$userStats = User::getStatistics(); $userStats = User::getStatistics();
$config->set('nodeinfo', 'total_users', $userStats['total_users']); $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"]); $local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
$config->set('nodeinfo', 'local_comments', $local_comments); $config->set('nodeinfo', 'local_comments', $local_comments);
$logger->debug('item statistics', ['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\Model\User;
use Friendica\Network\Probe; use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact; use Friendica\Protocol\PortableContact;
use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
require_once 'mod/nodeinfo.php'; require_once 'mod/nodeinfo.php';
@ -44,7 +45,14 @@ class CronJobs
break; break;
case 'nodeinfo': case 'nodeinfo':
Logger::info('cron_start');
Nodeinfo::update(); 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; break;
case 'expire_and_remove_users': case 'expire_and_remove_users':