Page MenuHomePhabricator

SettingsLoader: add finalize method
Closed, ResolvedPublic

Description

Add SettingsBuilder::finalize method. After the method is called, any attempt to modify the SettingsBuilder should throw exceptions. Call this method from Setup.php when we're done with SettingsBuilder

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DAlangi_WMF moved this task from Ideas to Doing on the MediaWiki-SettingsBuilder board.
DAlangi_WMF added a subscriber: xSavitar.

I see that in Setup.php, once all settings have been loaded, the $wgSettings container is destroyed completely. Do we still need the finalize() method or will that method be replacing what unset() is doing?

In addition, it looks like finalize() will just be similar to what ExtensionRegistry::finish() does? I just want to know if we'll be doing ->finalize() instead of unset() @Pchelolo?

Yeah, finalize instead of unset. I'm already removing the unset in some of the other patches. $wgSettings is useful to have access to in tests.

Change 742984 had a related patch set uploaded (by D3r1ck01; author: Derick Alangi):

[mediawiki/core@master] Settings: Lock applying more settings after invoking `->finalize()`

https://gerrit.wikimedia.org/r/742984

DAlangi_WMF changed the task status from Open to In Progress.Dec 1 2021, 4:47 PM

Change 742984 merged by jenkins-bot:

[mediawiki/core@master] Settings: Prevent applying more settings after invoking `->finalize()`

https://gerrit.wikimedia.org/r/742984