From dbbae15a8458679db0f4540dacdbdcff9c02ec8c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 7 Apr 2023 12:40:43 +0200 Subject: Remove ConfigurationSetter (#5251) This class has not been maintained for a while. Only a subset of our configuration properties are there, and some code is not relevant anymore. Furthermore, it is relying exclusively on dynamically invoked functions, making it challenging to maintain, in particular to find out what is used and what is not, what is handled and what is not. It is not well suited for changes in data formats, which have been handled in the Context class instead. It is also not able to handle configuration properties that are missing. It is the class with most errors for PHPStan level 6 (179 errors). It is also making intense use of is_callable and call_user_func_array, which are performance killers. Should the need arrise again to perform validation of our internal configuration files, I suggest an implementation with the opposite approach, namely driven by our code instead of driven by the data. In summary, at the moment, this class is costly, while not offering many guarantees. --- app/Models/Context.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'app/Models/Context.php') diff --git a/app/Models/Context.php b/app/Models/Context.php index 7c7af2791..b2631291a 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -104,9 +104,6 @@ final class FreshRSS_Context { if ($reload || FreshRSS_Context::$system_conf == null) { //TODO: Keep in session what we need instead of always reloading from disk FreshRSS_Context::$system_conf = FreshRSS_SystemConfiguration::init(DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php'); - // Register the configuration setter for the system configuration - $configurationSetter = new FreshRSS_ConfigurationSetter(); - FreshRSS_Context::$system_conf->_configurationSetter($configurationSetter); } return FreshRSS_Context::$system_conf; } @@ -132,8 +129,7 @@ final class FreshRSS_Context { //TODO: Keep in session what we need instead of always reloading from disk FreshRSS_Context::$user_conf = FreshRSS_UserConfiguration::init( USERS_PATH . '/' . $username . '/config.php', - FRESHRSS_PATH . '/config-user.default.php', - FreshRSS_Context::$system_conf->configurationSetter()); + FRESHRSS_PATH . '/config-user.default.php'); Minz_User::change($username); } catch (Exception $ex) { -- cgit v1.2.3