diff --git a/src/App.php b/src/App.php
index 3ea7d05f0..6f1045ada 100644
--- a/src/App.php
+++ b/src/App.php
@@ -144,16 +144,6 @@ class App
return $this->config->getCache();
}
- /**
- * Returns the current config of this node
- *
- * @return Configuration
- */
- public function getConfig()
- {
- return $this->config;
- }
-
/**
* The basepath of this app
*
diff --git a/src/Core/Search.php b/src/Core/Search.php
index c1c80091f..ab06a51a7 100644
--- a/src/Core/Search.php
+++ b/src/Core/Search.php
@@ -92,8 +92,7 @@ class Search
*/
public static function getContactsFromGlobalDirectory($search, $type = self::TYPE_ALL, $page = 1)
{
- $config = DI::app()->getConfig();
- $server = $config->get('system', 'directory', self::DEFAULT_DIRECTORY);
+ $server = DI::config()->get('system', 'directory', self::DEFAULT_DIRECTORY);
$searchUrl = $server . '/search';
@@ -158,7 +157,7 @@ class Search
*/
public static function getContactsFromLocalDirectory($search, $type = self::TYPE_ALL, $start = 0, $itemPage = 80)
{
- $config = DI::app()->getConfig();
+ $config = DI::config();
$diaspora = $config->get('system', 'diaspora_enabled') ? Protocol::DIASPORA : Protocol::DFRN;
$ostatus = !$config->get('system', 'ostatus_disabled') ? Protocol::OSTATUS : Protocol::DFRN;
diff --git a/src/Core/Worker.php b/src/Core/Worker.php
index b451b11ca..a87fef077 100644
--- a/src/Core/Worker.php
+++ b/src/Core/Worker.php
@@ -1086,7 +1086,7 @@ class Worker
$args = ['no_cron' => !$do_cron];
$a = get_app();
- $process = new Core\Process($a->getLogger(), $a->getMode(), $a->getConfig(), $a->getBasePath());
+ $process = new Core\Process($a->getLogger(), $a->getMode(), DI::config(), $a->getBasePath());
$process->run($command, $args);
// after spawning we have to remove the flag.
diff --git a/src/Model/Nodeinfo.php b/src/Model/Nodeinfo.php
index 29fa00aa1..58a9e4544 100644
--- a/src/Model/Nodeinfo.php
+++ b/src/Model/Nodeinfo.php
@@ -19,7 +19,7 @@ class Nodeinfo
public static function update()
{
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
$logger = $app->getLogger();
// If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php
index 25097d533..60b35289c 100644
--- a/src/Module/Admin/Summary.php
+++ b/src/Module/Admin/Summary.php
@@ -115,7 +115,7 @@ class Summary extends BaseAdminModule
$configCache = new Config\Cache\ConfigCache();
$configLoader->setupCache($configCache);
$confBasepath = $configCache->get('system', 'basepath');
- $currBasepath = $a->getConfig()->get('system', 'basepath');
+ $currBasepath = DI::config()->get('system', 'basepath');
if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) {
if (is_dir($confBasepath) && Config::set('system', 'basepath', $confBasepath)) {
$a->getLogger()->info('Friendica\'s system.basepath was updated successfully.', [
diff --git a/src/Module/BaseSearchModule.php b/src/Module/BaseSearchModule.php
index 0fa3eb5d6..efedca92a 100644
--- a/src/Module/BaseSearchModule.php
+++ b/src/Module/BaseSearchModule.php
@@ -35,7 +35,7 @@ class BaseSearchModule extends BaseModule
public static function performContactSearch($search, $prefix = '')
{
$a = DI::app();
- $config = $a->getConfig();
+ $config = DI::config();
$type = Search::TYPE_ALL;
diff --git a/src/Module/Bookmarklet.php b/src/Module/Bookmarklet.php
index bae0e7c4d..93f790a37 100644
--- a/src/Module/Bookmarklet.php
+++ b/src/Module/Bookmarklet.php
@@ -21,7 +21,7 @@ class Bookmarklet extends BaseModule
$_GET['mode'] = 'minimal';
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
if (!local_user()) {
$output = '
' . L10n::t('Login') . '
';
diff --git a/src/Module/Directory.php b/src/Module/Directory.php
index e38810e8e..4ad9438fb 100644
--- a/src/Module/Directory.php
+++ b/src/Module/Directory.php
@@ -25,7 +25,7 @@ class Directory extends BaseModule
public static function content(array $parameters = [])
{
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
if (($config->get('system', 'block_public') && !Session::isAuthenticated()) ||
($config->get('system', 'block_local_dir') && !Session::isAuthenticated())) {
diff --git a/src/Module/Friendica.php b/src/Module/Friendica.php
index 2eb2940ed..4f33fea43 100644
--- a/src/Module/Friendica.php
+++ b/src/Module/Friendica.php
@@ -19,7 +19,7 @@ class Friendica extends BaseModule
public static function content(array $parameters = [])
{
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
$visibleAddonList = Addon::getVisibleList();
if (!empty($visibleAddonList)) {
@@ -98,7 +98,7 @@ class Friendica extends BaseModule
return;
}
- $config = $app->getConfig();
+ $config = DI::config();
$register_policies = [
Register::CLOSED => 'REGISTER_CLOSED',
diff --git a/src/Module/Help.php b/src/Module/Help.php
index 0ff4cc68b..7c1ecd746 100644
--- a/src/Module/Help.php
+++ b/src/Module/Help.php
@@ -23,7 +23,7 @@ class Help extends BaseModule
$filename = '';
$a = DI::app();
- $config = $a->getConfig();
+ $config = DI::config();
$lang = $config->get('system', 'language');
// @TODO: Replace with parameter from router
diff --git a/src/Module/Home.php b/src/Module/Home.php
index eb122b052..f5032f7c3 100644
--- a/src/Module/Home.php
+++ b/src/Module/Home.php
@@ -17,7 +17,7 @@ class Home extends BaseModule
public static function content(array $parameters = [])
{
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
// currently no returned data is used
$ret = [];
diff --git a/src/Module/Invite.php b/src/Module/Invite.php
index 9261ea703..52d9bbcea 100644
--- a/src/Module/Invite.php
+++ b/src/Module/Invite.php
@@ -26,7 +26,7 @@ class Invite extends BaseModule
self::checkFormSecurityTokenRedirectOnError('/', 'send_invite');
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
$max_invites = intval($config->get('system', 'max_invites'));
if (!$max_invites) {
@@ -112,7 +112,7 @@ class Invite extends BaseModule
}
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
$inviteOnly = false;
diff --git a/src/Module/Maintenance.php b/src/Module/Maintenance.php
index 35a6df629..bee9ab53f 100644
--- a/src/Module/Maintenance.php
+++ b/src/Module/Maintenance.php
@@ -17,9 +17,7 @@ class Maintenance extends BaseModule
{
public static function content(array $parameters = [])
{
- $config = DI::app()->getConfig();
-
- $reason = $config->get('system', 'maintenance_reason');
+ $reason = DI::config()->get('system', 'maintenance_reason');
if ((substr(Strings::normaliseLink($reason), 0, 7) === 'http://') ||
(substr(Strings::normaliseLink($reason), 0, 8) === 'https://')) {
diff --git a/src/Module/Manifest.php b/src/Module/Manifest.php
index de1dfc915..a7ef344e4 100644
--- a/src/Module/Manifest.php
+++ b/src/Module/Manifest.php
@@ -10,8 +10,7 @@ class Manifest extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
$tpl = Renderer::getMarkupTemplate('manifest.tpl');
diff --git a/src/Module/NodeInfo.php b/src/Module/NodeInfo.php
index 5c5b573b2..a62687de1 100644
--- a/src/Module/NodeInfo.php
+++ b/src/Module/NodeInfo.php
@@ -2,10 +2,8 @@
namespace Friendica\Module;
-use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\Addon;
-use Friendica\Core\System;
use Friendica\DI;
/**
@@ -16,12 +14,10 @@ class NodeInfo extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = DI::app();
-
if ($parameters['version'] == '1.0') {
- self::printNodeInfo1($app);
+ self::printNodeInfo1();
} elseif ($parameters['version'] == '2.0') {
- self::printNodeInfo2($app);
+ self::printNodeInfo2();
} else {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
@@ -30,13 +26,11 @@ class NodeInfo extends BaseModule
/**
* Return the supported services
*
- * @param App $app
- *
* @return array with supported services
*/
- private static function getUsage(App $app)
+ private static function getUsage()
{
- $config = $app->getConfig();
+ $config = DI::config();
$usage = [];
@@ -56,11 +50,9 @@ class NodeInfo extends BaseModule
/**
* Return the supported services
*
- * @param App $app
- *
* @return array with supported services
*/
- private static function getServices(App $app)
+ private static function getServices()
{
$services = [
'inbound' => [],
@@ -117,12 +109,10 @@ class NodeInfo extends BaseModule
/**
* Print the nodeinfo version 1
- *
- * @param App $app
*/
- private static function printNodeInfo1(App $app)
+ private static function printNodeInfo1()
{
- $config = $app->getConfig();
+ $config = DI::config();
$nodeinfo = [
'version' => '1.0',
@@ -156,9 +146,9 @@ class NodeInfo extends BaseModule
$nodeinfo['protocols']['outbound'][] = 'gnusocial';
}
- $nodeinfo['usage'] = self::getUsage($app);
+ $nodeinfo['usage'] = self::getUsage();
- $nodeinfo['services'] = self::getServices($app);
+ $nodeinfo['services'] = self::getServices();
$nodeinfo['metadata']['protocols'] = $nodeinfo['protocols'];
$nodeinfo['metadata']['protocols']['outbound'][] = 'atom1.0';
@@ -180,12 +170,10 @@ class NodeInfo extends BaseModule
/**
* Print the nodeinfo version 2
- *
- * @param App $app
*/
- private static function printNodeInfo2(App $app)
+ private static function printNodeInfo2()
{
- $config = $app->getConfig();
+ $config = DI::config();
$imap = (function_exists('imap_open') && !$config->get('system', 'imap_disabled') && !$config->get('system', 'dfrn_only'));
@@ -212,9 +200,9 @@ class NodeInfo extends BaseModule
$nodeinfo['protocols'][] = 'ostatus';
}
- $nodeinfo['usage'] = self::getUsage($app);
+ $nodeinfo['usage'] = self::getUsage();
- $nodeinfo['services'] = self::getServices($app);
+ $nodeinfo['services'] = self::getServices();
if (Addon::isEnabled('twitter')) {
$nodeinfo['services']['inbound'][] = 'twitter';
diff --git a/src/Module/Register.php b/src/Module/Register.php
index d079c5c42..9a6df2f63 100644
--- a/src/Module/Register.php
+++ b/src/Module/Register.php
@@ -198,7 +198,7 @@ class Register extends BaseModule
$arr['blocked'] = $blocked;
$arr['verified'] = $verified;
- $arr['language'] = L10nClass::detectLanguage($_SERVER, $_GET, $a->getConfig()->get('system', 'language'));
+ $arr['language'] = L10nClass::detectLanguage($_SERVER, $_GET, DI::config()->get('system', 'language'));
try {
$result = Model\User::create($arr);
diff --git a/src/Module/Security/Login.php b/src/Module/Security/Login.php
index dc129e8f6..a049abc88 100644
--- a/src/Module/Security/Login.php
+++ b/src/Module/Security/Login.php
@@ -88,7 +88,7 @@ class Login extends BaseModule
}
$reg = false;
- if ($register && intval($a->getConfig()->get('config', 'register_policy')) !== Register::CLOSED) {
+ if ($register && intval(DI::config()->get('config', 'register_policy')) !== Register::CLOSED) {
$reg = [
'title' => L10n::t('Create a New Account'),
'desc' => L10n::t('Register'),
diff --git a/src/Module/Statistics.php b/src/Module/Statistics.php
index 1fe129011..11cbdf53a 100644
--- a/src/Module/Statistics.php
+++ b/src/Module/Statistics.php
@@ -4,23 +4,21 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\Addon;
-use Friendica\Core\System;
use Friendica\DI;
+use Friendica\Network\HTTPException\NotFoundException;
class Statistics extends BaseModule
{
public static function init(array $parameters = [])
{
- $config = DI::app()->getConfig();
-
- if (!$config->get("system", "nodeinfo")) {
- throw new \Friendica\Network\HTTPException\NotFoundException();
+ if (!DI::config()->get("system", "nodeinfo")) {
+ throw new NotFoundException();
}
}
public static function rawContent(array $parameters = [])
{
- $config = DI::app()->getConfig();
+ $config = DI::config();
$logger = DI::app()->getLogger();
$registration_open =
diff --git a/src/Module/Welcome.php b/src/Module/Welcome.php
index e62c5a62d..618214633 100644
--- a/src/Module/Welcome.php
+++ b/src/Module/Welcome.php
@@ -14,7 +14,7 @@ class Welcome extends BaseModule
{
public static function content(array $parameters = [])
{
- $config = DI::app()->getConfig();
+ $config = DI::config();
$mail_disabled = ((function_exists('imap_open') &&
(!$config->get('system', 'imap_disabled'))));
diff --git a/src/Module/WellKnown/HostMeta.php b/src/Module/WellKnown/HostMeta.php
index 3b03567d7..aec95c2a2 100644
--- a/src/Module/WellKnown/HostMeta.php
+++ b/src/Module/WellKnown/HostMeta.php
@@ -17,7 +17,7 @@ class HostMeta extends BaseModule
public static function rawContent(array $parameters = [])
{
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
header('Content-type: text/xml');
diff --git a/src/Module/WellKnown/XSocialRelay.php b/src/Module/WellKnown/XSocialRelay.php
index 2ddac3836..38a9e1243 100644
--- a/src/Module/WellKnown/XSocialRelay.php
+++ b/src/Module/WellKnown/XSocialRelay.php
@@ -15,7 +15,7 @@ class XSocialRelay extends BaseModule
public static function rawContent(array $parameters = [])
{
$app = DI::app();
- $config = $app->getConfig();
+ $config = DI::config();
$subscribe = $config->get('system', 'relay_subscribe', false);