Merge pull request #803 from nupplaphil/config_refact

Config Refactoring
pull/805/head
Hypolite Petovan 2019-02-06 10:52:02 -05:00 committed by GitHub
commit 37dd8a938b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 28 additions and 26 deletions

View File

@ -54,13 +54,13 @@ use Symfony\Component\ExpressionLanguage;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
function advancedcontentfilter_install()
function advancedcontentfilter_install(App $a)
{
Hook::register('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition');
Hook::register('prepare_body_content_filter', __FILE__, 'advancedcontentfilter_prepare_body_content_filter');
Hook::register('addon_settings' , __FILE__, 'advancedcontentfilter_addon_settings');
DBStructure::update(false, true);
DBStructure::update($a->getBasePath(), false, true);
Logger::log("installed advancedcontentfilter");
}

View File

@ -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->loadAddonConfig('geonames'));
}
function geonames_post_hook($a, &$item) {

View File

@ -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->loadAddonConfig('gravatar'));
}
/**

View File

@ -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->loadAddonConfig('impressum'));
}
function impressum_show($a,&$b) {

View File

@ -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->loadAddonConfig('ldapauth'));
}
function ldapauth_hook_authenticate($a, &$b)

View File

@ -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->loadAddonConfig('libravatar'));
}
/**

View File

@ -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->loadAddonConfig('openstreetmap'));
}
function openstreetmap_alterheader($a, &$navHtml)

View File

@ -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->loadAddonConfig('piwik'));
}
function piwik_analytics($a,&$b) {

View File

@ -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->loadAddonConfig('public_server'));
}
function public_server_register_account($a, $b)

View File

@ -377,9 +377,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->loadAddonConfig('pumpio'));
}
function pumpio_hook_fork(App $a, array &$b)

View File

@ -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->loadAddonConfig('testdrive'));
}
function testdrive_globaldir_update($a,&$b) {

View File

@ -136,9 +136,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->loadAddonConfig('twitter'));
}
function twitter_check_item_notification(App $a, array &$notification_data)