]> git.mxchange.org Git - friendica.git/blobdiff - mod/nodeinfo.php
Merge pull request #6559 from tobiasd/20190130-admininiwarning
[friendica.git] / mod / nodeinfo.php
index ed0166838fdc3df1733d15328234051a80a8a23e..39f430f92f2e249ea37d092c32b34a02b26ba550 100644 (file)
@@ -8,11 +8,10 @@
 use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Util\Network;
-require_once 'include/dba.php';
-
 function nodeinfo_wellknown(App $a) {
        $nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
                                        'href' => System::baseUrl().'/nodeinfo/1.0']]];
@@ -25,12 +24,10 @@ function nodeinfo_wellknown(App $a) {
 function nodeinfo_init(App $a) {
        if (!Config::get('system', 'nodeinfo')) {
                System::httpExit(404);
-               killme();
        }
 
        if (($a->argc != 2) || ($a->argv[1] != '1.0')) {
                System::httpExit(404);
-               killme();
        }
 
        $smtp = (function_exists('imap_open') && !Config::get('system', 'imap_disabled') && !Config::get('system', 'dfrn_only'));
@@ -62,7 +59,7 @@ function nodeinfo_init(App $a) {
 
        $nodeinfo['usage'] = [];
 
-       $nodeinfo['openRegistrations'] = intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED;
+       $nodeinfo['openRegistrations'] = intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED;
 
        $nodeinfo['metadata'] = ['nodeName' => Config::get('config', 'sitename')];
 
@@ -84,10 +81,6 @@ function nodeinfo_init(App $a) {
                        $nodeinfo['services']['inbound'][] = 'gnusocial';
                        $nodeinfo['services']['outbound'][] = 'gnusocial';
                }
-
-               if (Addon::isEnabled('gpluspost') || Addon::isEnabled('buffer')) {
-                       $nodeinfo['services']['outbound'][] = 'google';
-               }
                if (Addon::isEnabled('ijpost')) {
                        $nodeinfo['services']['outbound'][] = 'insanejournal';
                }
@@ -146,7 +139,7 @@ function nodeinfo_init(App $a) {
 
 function nodeinfo_cron() {
 
-       $a = get_app();
+       $a = \get_app();
 
        // If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
        if (Addon::isEnabled('statistics_json')) {
@@ -154,7 +147,6 @@ function nodeinfo_cron() {
 
                $addon = 'statistics_json';
                $addons = Config::get('system', 'addon');
-               $addons_arr = [];
 
                if ($addons) {
                        $addons_arr = explode(',',str_replace(' ', '',$addons));
@@ -172,7 +164,7 @@ function nodeinfo_cron() {
                return;
        }
 
-       logger('cron_start');
+       Logger::log('cron_start');
 
        $users = q("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item`
                        FROM `user`
@@ -203,22 +195,22 @@ function nodeinfo_cron() {
                Config::set('nodeinfo', 'active_users_halfyear', $active_users_halfyear);
                Config::set('nodeinfo', 'active_users_monthly', $active_users_monthly);
 
-               logger('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
+               Logger::log('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, Logger::DEBUG);
        }
 
        $local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
        Config::set('nodeinfo', 'local_posts', $local_posts);
-       logger('local_posts: ' . $local_posts, LOGGER_DEBUG);
+       Logger::log('local_posts: ' . $local_posts, Logger::DEBUG);
 
        $local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
        Config::set('nodeinfo', 'local_comments', $local_comments);
-       logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
+       Logger::log('local_comments: ' . $local_comments, Logger::DEBUG);
 
        // Now trying to register
        $url = 'http://the-federation.info/register/'.$a->getHostName();
-       logger('registering url: '.$url, LOGGER_DEBUG);
+       Logger::log('registering url: '.$url, Logger::DEBUG);
        $ret = Network::fetchUrl($url);
-       logger('registering answer: '.$ret, LOGGER_DEBUG);
+       Logger::log('registering answer: '.$ret, Logger::DEBUG);
 
-       logger('cron_end');
+       Logger::log('cron_end');
 }