stable

Clone or download

Read-only

feat(forge-config): Default value from attributes (plugins)

After Core, plugins can now define default values for their configuration variables. It's now the preferred method over setting the value in DB directly. This part is a bit trickier than for Core because we have to keep the lazy loading aspect of Plugins (otherwise the performance will be severly hit). The design decision was to resolve the default values when creating the cache vs only store classes that holds configuration variables because if we chose the later, when loaded from cache the classes cannot be loaded (plugins not autoload). It's also a bit trickier than for other loaders because due to the way ForgeConfig works, the customized values, store in database, will be loaded **before** the attributes. Since the load of ForgeConfig::loadInSequence is done at the earliest in the request processing AND that variables that comes from the DB are loaded during loadInSequence, then if a variable is already set it has a value in DB. Due to lazy loading, the value that might come from attributes will be loaded after (when plugin system is loaded) so existing values **must not** be override. Finally, I propose to share a common interface between GetKeysList event and SerializedPluginProxy to gather classes that exposes ConfigKey. It's handy but I don't know if it's a good idea. How to test ? tuleap config-get feature_flag_doc_gen_cross_tracker_report_xslx_export now returns 0 instead of saying that value is not defined Part of: story #22708 flexibility in the management of Tuleap Configuration Change-Id: Idbd3614f94659bfae7c502ef97ea3826ba21aad5

Modified Files

Name
M plugins/agiledashboard/include/agiledashboardPlugin.php +5 −7 Go to diff View file
M plugins/docman/include/docmanPlugin.php +5 −5 Go to diff View file
M plugins/document_generation/include/FeatureFlagCrossTrackerReportAction.php +2 −0 Go to diff View file
M plugins/document_generation/include/document_generationPlugin.php +4 −4 Go to diff View file
M plugins/gitlfs/include/gitlfsPlugin.php +6 −4 Go to diff View file
M plugins/openidconnectclient/include/openidconnectclientPlugin.php +5 −4 Go to diff View file
M plugins/svn/include/svnPlugin.php +5 −4 Go to diff View file
M plugins/tracker/include/trackerPlugin.php +5 −8 Go to diff View file
A src/common/Config/ConfigClassProvider.php +32 −0 Go to diff View file
M src/common/Config/ConfigValueDefaultValueAttributeProvider.php +23 −2 Go to diff View file
M src/common/Config/ConfigurationVariables.php +1 −1 Go to diff View file
M src/common/Config/ConstantWithConfigAttributesBuilder.php +12 −13 Go to diff View file
M src/common/Config/ForgeConfig.php +13 −0 Go to diff View file
M src/common/Config/GetConfigKeys.php +1 −1 Go to diff View file
A src/common/Config/PluginWithConfigKeys.php +30 −0 Go to diff View file
M src/common/Plugin/EventPluginCache.php +12 −20 Go to diff View file
M src/common/Plugin/Plugin.php +5 −20 Go to diff View file
M src/common/Plugin/PluginLoader.php +6 −1 Go to diff View file
M src/common/Plugin/SerializedPluginProxy.php +37 −10 Go to diff View file
M tests/unit/common/Config/ForgeConfigTest.php +34 −2 Go to diff View file
M tests/unit/common/Plugin/PluginTest.php +29 −0 Go to diff View file
A tests/unit/common/Plugin/SerializedPluginProxyTest.php +77 −0 Go to diff View file