Introduce ConfigFileManager for config files

This commit is contained in:
Philipp Holzer 2023-01-01 20:21:56 +01:00
parent 14dfd24d11
commit 005f9af69b
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
12 changed files with 24 additions and 24 deletions

View file

@ -11,7 +11,7 @@ use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Util\XML; use Friendica\Util\XML;
function geonames_install() function geonames_install()
@ -33,7 +33,7 @@ function geonames_install()
Hook::register('addon_settings_post', __FILE__, 'geonames_addon_settings_post'); Hook::register('addon_settings_post', __FILE__, 'geonames_addon_settings_post');
} }
function geonames_load_config(App $a, ConfigFileLoader $loader) function geonames_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('geonames'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('geonames'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -13,7 +13,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Util\Strings; use Friendica\Util\Strings;
/** /**
@ -26,7 +26,7 @@ function gravatar_install() {
Logger::notice("registered gravatar in avatar_lookup hook"); Logger::notice("registered gravatar in avatar_lookup hook");
} }
function gravatar_load_config(App $a, ConfigFileLoader $loader) function gravatar_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('gravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('gravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -13,7 +13,7 @@ use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
function impressum_install() function impressum_install()
@ -54,7 +54,7 @@ function impressum_footer(App $a, string &$body)
} }
} }
function impressum_load_config(App $a, ConfigFileLoader $loader) function impressum_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -35,7 +35,7 @@ use Friendica\Core\Logger;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
function ldapauth_install() function ldapauth_install()
{ {
@ -43,7 +43,7 @@ function ldapauth_install()
Hook::register('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate'); Hook::register('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
} }
function ldapauth_load_config(App $a, ConfigFileLoader $loader) function ldapauth_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -12,7 +12,7 @@ use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
/** /**
* Installs the addon hook * Installs the addon hook
@ -24,7 +24,7 @@ function libravatar_install()
Logger::notice("registered libravatar in avatar_lookup hook"); Logger::notice("registered libravatar in avatar_lookup hook");
} }
function libravatar_load_config(App $a, ConfigFileLoader $loader) function libravatar_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -15,7 +15,7 @@ use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Util\Strings; use Friendica\Util\Strings;
const OSM_TMS = 'https://www.openstreetmap.org'; const OSM_TMS = 'https://www.openstreetmap.org';
@ -35,7 +35,7 @@ function openstreetmap_install()
Logger::notice("installed openstreetmap"); Logger::notice("installed openstreetmap");
} }
function openstreetmap_load_config(App $a, ConfigFileLoader $loader) function openstreetmap_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -11,7 +11,7 @@ use Friendica\App;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\DI; use Friendica\DI;
use Friendica\Object\EMail\IEmail; use Friendica\Object\EMail\IEmail;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\Exception;
@ -23,7 +23,7 @@ function phpmailer_install()
Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare', 5); Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare', 5);
} }
function phpmailer_load_config(App $a, ConfigFileLoader $loader) function phpmailer_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -39,7 +39,7 @@ use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
function piwik_install() { function piwik_install() {
Hook::register('load_config', 'addon/piwik/piwik.php', 'piwik_load_config'); Hook::register('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
@ -48,7 +48,7 @@ function piwik_install() {
Logger::notice("installed piwik addon"); Logger::notice("installed piwik addon");
} }
function piwik_load_config(App $a, ConfigFileLoader $loader) function piwik_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('piwik'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('piwik'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -15,7 +15,7 @@ use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Notification; use Friendica\Model\Notification;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
function public_server_install() function public_server_install()
@ -27,7 +27,7 @@ function public_server_install()
Hook::register('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); Hook::register('logged_in', 'addon/public_server/public_server.php', 'public_server_login');
} }
function public_server_load_config(App $a, ConfigFileLoader $loader) function public_server_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -26,7 +26,7 @@ use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityNamespace; use Friendica\Protocol\ActivityNamespace;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\XML; use Friendica\Util\XML;
@ -318,7 +318,7 @@ function pumpio_settings_post(App $a, array &$b)
} }
} }
function pumpio_load_config(App $a, ConfigFileLoader $loader) function pumpio_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -13,7 +13,7 @@ use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Notification; use Friendica\Model\Notification;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
function testdrive_install() function testdrive_install()
@ -25,7 +25,7 @@ function testdrive_install()
Hook::register('globaldir_update','addon/testdrive/testdrive.php', 'testdrive_globaldir_update'); Hook::register('globaldir_update','addon/testdrive/testdrive.php', 'testdrive_globaldir_update');
} }
function testdrive_load_config(App $a, ConfigFileLoader $loader) function testdrive_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('testdrive'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('testdrive'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }

View file

@ -86,7 +86,7 @@ use Friendica\Model\Post;
use Friendica\Model\Tag; use Friendica\Model\Tag;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Core\Config\Util\ConfigFileLoader; use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
@ -124,7 +124,7 @@ function twitter_install()
// Hook functions // Hook functions
function twitter_load_config(App $a, ConfigFileLoader $loader) function twitter_load_config(App $a, ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('twitter'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); $a->getConfigCache()->load($loader->loadAddonConfig('twitter'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }