]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/GServer.php
Raw content is now stored with announce messages as well
[friendica.git] / src / Model / GServer.php
index eca4c5a7e203f3f37c3539eb9119a63662a48fc2..0f5f55ab671a19979fd4b1a02659d199a889fb24 100644 (file)
@@ -1,17 +1,32 @@
 <?php
-
 /**
- * @file src/Model/GServer.php
- * This file includes the GServer class to handle with servers
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
+
 namespace Friendica\Model;
 
 use DOMDocument;
 use DOMXPath;
-use Friendica\Core\Config;
 use Friendica\Core\Protocol;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Module\Register;
 use Friendica\Network\CurlResult;
 use Friendica\Util\Network;
@@ -192,7 +207,7 @@ class GServer
                }
 
                // When a nodeinfo is present, we don't need to dig further
-               $xrd_timeout = Config::get('system', 'xrd_timeout');
+               $xrd_timeout = DI::config()->get('system', 'xrd_timeout');
                $curlResult = Network::curl($url . '/.well-known/nodeinfo', false, ['timeout' => $xrd_timeout]);
                if ($curlResult->isTimeout()) {
                        DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => Strings::normaliseLink($url)]);
@@ -726,7 +741,7 @@ class GServer
         */
        private static function validHostMeta(string $url)
        {
-               $xrd_timeout = Config::get('system', 'xrd_timeout');
+               $xrd_timeout = DI::config()->get('system', 'xrd_timeout');
                $curlResult = Network::curl($url . '/.well-known/host-meta', false, ['timeout' => $xrd_timeout]);
                if (!$curlResult->isSuccess()) {
                        return false;
@@ -1348,7 +1363,7 @@ class GServer
 
                $no_of_queries = 5;
 
-               $requery_days = intval(Config::get('system', 'poco_requery_days'));
+               $requery_days = intval(DI::config()->get('system', 'poco_requery_days'));
 
                if ($requery_days == 0) {
                        $requery_days = 7;
@@ -1388,7 +1403,7 @@ class GServer
         */
        private static function discoverFederation()
        {
-               $last = Config::get('poco', 'last_federation_discovery');
+               $last = DI::config()->get('poco', 'last_federation_discovery');
 
                if ($last) {
                        $next = $last + (24 * 60 * 60);
@@ -1412,7 +1427,7 @@ class GServer
                }
 
                // Disvover Mastodon servers
-               $accesstoken = Config::get('system', 'instances_social_key');
+               $accesstoken = DI::config()->get('system', 'instances_social_key');
 
                if (!empty($accesstoken)) {
                        $api = 'https://instances.social/api/1.0/instances/list?count=0';
@@ -1429,6 +1444,6 @@ class GServer
                        }
                }
 
-               Config::set('poco', 'last_federation_discovery', time());
+               DI::config()->set('poco', 'last_federation_discovery', time());
        }
 }