<?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;
}
// 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)]);
*/
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;
$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;
*/
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);
}
// 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';
}
}
- Config::set('poco', 'last_federation_discovery', time());
+ DI::config()->set('poco', 'last_federation_discovery', time());
}
}