From b541efc5e6bf72768215f4a59494c02cdc9058ba Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sun, 3 Feb 2019 22:22:03 +0100 Subject: [PATCH] 3) Introducing ConfigFactory --- geonames/geonames.php | 5 +++-- gravatar/gravatar.php | 4 ++-- impressum/impressum.php | 4 ++-- ldapauth/ldapauth.php | 5 +++-- libravatar/libravatar.php | 4 ++-- openstreetmap/openstreetmap.php | 6 +++--- piwik/piwik.php | 5 +++-- public_server/public_server.php | 5 ++--- pumpio/pumpio.php | 4 ++-- testdrive/testdrive.php | 4 ++-- twitter/twitter.php | 4 ++-- 11 files changed, 26 insertions(+), 24 deletions(-) diff --git a/geonames/geonames.php b/geonames/geonames.php index 7023336bc..305771765 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -21,6 +21,7 @@ * system will call the name_uninstall() function. * */ + use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; @@ -76,9 +77,9 @@ function geonames_uninstall() { Logger::log("removed geonames"); } -function geonames_load_config(\Friendica\App $a) +function geonames_load_config(\Friendica\App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__. '/config/geonames.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('geonames')); } function geonames_post_hook($a, &$item) { diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index 70e81448d..e5fd4c068 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -36,9 +36,9 @@ function gravatar_uninstall() { Logger::log("unregistered gravatar in avatar_lookup hook"); } -function gravatar_load_config(App $a) +function gravatar_load_config(App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/gravatar.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('gravatar')); } /** diff --git a/impressum/impressum.php b/impressum/impressum.php index b68c0e2ea..c8ca7e34d 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -52,9 +52,9 @@ function impressum_footer($a, &$b) { } } -function impressum_load_config(\Friendica\App $a) +function impressum_load_config(\Friendica\App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/impressum.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('impressum')); } function impressum_show($a,&$b) { diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index e564bbe63..637643a8a 100644 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -53,6 +53,7 @@ * * ...etc. */ + use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\Logger; @@ -70,9 +71,9 @@ function ldapauth_uninstall() Hook::unregister('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate'); } -function ldapauth_load_config(\Friendica\App $a) +function ldapauth_load_config(\Friendica\App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/ldapauth.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('ldapauth')); } function ldapauth_hook_authenticate($a, &$b) diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 232278a99..e4f3672ae 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -36,9 +36,9 @@ function libravatar_uninstall() Logger::log("unregistered libravatar in avatar_lookup hook"); } -function libravatar_load_config(App $a) +function libravatar_load_config(App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/libravatar.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('libravatar')); } /** diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index c3982ec5b..09ad61b67 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -8,13 +8,13 @@ * Author: Klaus Weidenbach * */ + use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\Renderer; -use Friendica\Core\System; use Friendica\Util\Network; use Friendica\Util\Strings; @@ -47,9 +47,9 @@ function openstreetmap_uninstall() Logger::log("removed openstreetmap"); } -function openstreetmap_load_config(\Friendica\App $a) +function openstreetmap_load_config(\Friendica\App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/openstreetmap.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('openstreetmap')); } function openstreetmap_alterheader($a, &$navHtml) diff --git a/piwik/piwik.php b/piwik/piwik.php index fa04413ec..2143c3318 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -30,6 +30,7 @@ * about http/https but beware to put the trailing / at the end of your * setting. */ + use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; @@ -51,9 +52,9 @@ function piwik_uninstall() { Logger::log("uninstalled piwik addon"); } -function piwik_load_config(\Friendica\App $a) +function piwik_load_config(\Friendica\App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/piwik.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('piwik')); } function piwik_analytics($a,&$b) { diff --git a/public_server/public_server.php b/public_server/public_server.php index 52d9c6e0f..8769b2178 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -8,7 +8,6 @@ use Friendica\App; use Friendica\BaseModule; -use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; @@ -36,9 +35,9 @@ function public_server_uninstall() Hook::unregister('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); } -function public_server_load_config(App $a) +function public_server_load_config(App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/public_server.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('public_server')); } function public_server_register_account($a, $b) diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 875833585..55943a816 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -378,9 +378,9 @@ function pumpio_settings_post(App $a, array &$b) } } -function pumpio_load_config(App $a) +function pumpio_load_config(App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/pumpio.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('pumpio')); } function pumpio_hook_fork(App $a, array &$b) diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index f15acc266..272e6b9d8 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -35,9 +35,9 @@ function testdrive_uninstall() { } -function testdrive_load_config(App $a) +function testdrive_load_config(App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/testdrive.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('testdrive')); } function testdrive_globaldir_update($a,&$b) { diff --git a/twitter/twitter.php b/twitter/twitter.php index 64b8f4091..3054a3452 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -140,9 +140,9 @@ function twitter_uninstall() Hook::unregister('addon_settings_post', __FILE__, 'twitter_settings_post'); } -function twitter_load_config(App $a) +function twitter_load_config(App $a, Config\ConfigCacheLoader $loader) { - $a->loadConfigFile(__DIR__ . '/config/twitter.config.php'); + $a->getConfig()->loadConfigArray($loader->loadConfigFile('twitter')); } function twitter_check_item_notification(App $a, array &$notification_data)