Page MenuHomePhabricator

Default configuration parameter settings get merged with new settings
Open, Needs TriagePublic


What I want to do is define these three settings by defining a new array for the configuration parameter:

$wgHostStatsCommands = [
	'df -H',
	'lsb_release -d',

What happens is that also the default settings are considered, i.e. in the end 'hostname', 'df-h', 'df -H', 'lsb_release -d', 'date' are shown instead of just 'df -H', 'lsb_release -d', 'date' as desired. This started after the conversion to the extension registration system. Apparently I have no clue how to fix the extension.json file, i.e. how to disable any existing merge strategy to "config".

Event Timeline

Kghbln created this task.Jun 13 2019, 7:56 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 13 2019, 7:56 PM
Kghbln added a subscriber: Legoktm.Jun 13 2019, 7:58 PM

@Legoktm You might be able to help here. The docu about merge strategies does not provide a clue. Perhaps this is even the wrong spot to look how to fix this.

If we change extension.json to:

	"config": {
		"HostStatsCommands": {
			"value": {
				"hostname": true,
				"df -h": true

Then in LocalSettings, we can do:

$wgHostStatsCommands = [
	'hostname' => false,
	'df -h' => false,
	'df -H' => true,
	'lsb_release -d' => true,
	'date' => true,

And in the code, use array_filter( $wgHostStatsCommands ).

The problem with list style arrays is that it's hard/mostly impossible to determine whether the configuration in LocalSettings.php is trying to append to the default list or overwrite it entirely. But the => true / => false thing gets around that.

Change 516958 had a related patch set uploaded (by Kghbln; owner: Kghbln):
[mediawiki/extensions/HostStats@master] Release version 2.0.0

@Legoktm Thanks a lot for your explanation and advice!!! I authored a new version since this is breaking.

Change 516958 abandoned by Kghbln:
Release version 2.0.0

Second thoughts: This is getting too complicated also for admins. Thus abandoing for another approach.

Now coming with I just removed the initial settings for everyone to choose whatever they like from the start. Moreover a less breaking thus preferable approach.