Skip to content

Remove ConfigurationSetter#5251

Merged
Alkarex merged 5 commits intoFreshRSS:edgefrom
Alkarex:remove-ConfigurationSetter
Apr 7, 2023
Merged

Remove ConfigurationSetter#5251
Alkarex merged 5 commits intoFreshRSS:edgefrom
Alkarex:remove-ConfigurationSetter

Conversation

@Alkarex
Copy link
Copy Markdown
Member

@Alkarex Alkarex commented Apr 2, 2023

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 arise 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.

Contributes to #4112

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.
@Alkarex Alkarex added the System care Everything related to system care label Apr 2, 2023
@Alkarex Alkarex added this to the 1.22.0 milestone Apr 2, 2023
Comment on lines -94 to -111
/**
* List of enabled extensions.
*/
private $extensions_enabled = [];

public function removeExtension($ext_name) {
unset($this->extensions_enabled[$ext_name]);
$legacyKey = array_search($ext_name, $this->extensions_enabled, true);
if ($legacyKey !== false) { //Legacy format FreshRSS < 1.11.1
unset($this->extensions_enabled[$legacyKey]);
}
}
public function addExtension($ext_name) {
if (!isset($this->extensions_enabled[$ext_name])) {
$this->extensions_enabled[$ext_name] = true;
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #5243

@Alkarex Alkarex merged commit dbbae15 into FreshRSS:edge Apr 7, 2023
@Alkarex Alkarex deleted the remove-ConfigurationSetter branch April 7, 2023 10:40
Alkarex added a commit to Alkarex/FreshRSS that referenced this pull request Apr 16, 2023
Add interface to replace removed class from FreshRSS#5251
Alkarex added a commit that referenced this pull request Apr 17, 2023
* Complete PHPStan Level 6
Fix #4112
And initiate PHPStan Level 7

* PHPStan Level 6 for tests
* Use phpstan/phpstan-phpunit
* Update to PHPStan version 1.10

* Fix mixed bug

* Fix mixed return bug

* Fix paginator bug

* Fix FreshRSS_UserConfiguration

* A couple more Minz_Configuration bug fixes

* A few trivial PHPStan Level 7 fixes

* A few more simple PHPStan Level 7

* More files passing PHPStan Level 7
Add interface to replace removed class from #5251

* A few more PHPStan Level 7 preparations

* A few last details
Comment on lines -104 to -105
if ($value instanceof FreshRSS_UserQuery) {
$data['queries'][] = $value->toArray();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This magic call was forgotten. Fixed in #5318

Comment on lines -85 to -88
$languages = Minz_Translate::availableLanguages();
if (!in_array($value, $languages)) {
$value = 'en';
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

System care Everything related to system care

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants