HomePhabricator

Make configuration testable

Authored by awight.

Description

Make configuration testable

Get rid of conditional initialization, this made it impossible to test multiple
configurations.

Disable all components by default.

Deployment notes

You must rename and and new variables in LocalSettings.php to use this patch.
Enabling gateways looks like this now:

$wgGlobalCollectGatewayEnabled = true;

Please add a line for each gateway you would like enabled.

All "optional parts" are disabled by default now. Add lines for any custom
filters and features you desire. Adding the following lines before your local
settings will give the same behavior as defaults as they were before this
patch, not including gateways:

$wgDonationInterfaceEnableFormChooser = true;
$wgDonationInterfaceEnableFunctionsFilter = true;
$wgDonationInterfaceEnableMinfraud = true;
$wgDonationInterfaceEnableReferrerFilter = true;
$wgDonationInterfaceEnableSourceFilter = true;

TODO:

  • It's creepy to allow GatewayFormChooser to return results for disabled

gateways, but the idea is that we've removing forms from
$wgDonationInterfaceAllowedHtmlForms, so we return an empty array anyway.
This was not consistent in previous code, some forms were gated on configuration,
most were not.

  • Something here should work out of the box. Enable a dummy gateway by default?
  • We should use getGlobal everywhere, for example when testing the EnableStomp

configuration, so all features can be toggled per gateway.

Bug: T94477
Change-Id: I02bfbf7d46ef9946aae97ead562fc87cc29b5a4e