Requests for comment/PlatformSettings.php

Introduce a standardized and recommended way for re-distributors and packagers of MediaWiki to be able to tune DefaultSettings.php as appropriate.

Background
Packagers of MediaWiki often have some customizations to DefaultSettings.php that they want to do. For example, the Debian package currently adds the following:

This is currently done by having the installer use a custom DebianLocalSettingsGenerator, so when the installer is run, that snippet is added to the generated LocalSettings.php.

Problem
Because these settings are written into LocalSettings.php, existing installations won't see any changes to these defaults unless they regenerate their LocalSettings.php (rare). For example, I'd like to add some security hardening by setting  since I know that the package will make sure firejail is available. But unless everyone regenerates their LocalSettings.php, it won't take effect.

I specifically want to avoid hacking and patching MediaWiki to set better defaults, I believe the solution I've proposed is as minimal as possible, but still functional.

Idea 1
Introduce the concept of distribution provided platform settings. The distributor/packager will create a PHP file located in. MediaWiki will check if that file exists, and if so load it, right after DefaultSettings.php, for example:

The upside to this is mostly on the packaging end - instead of needing to patch DefaultSettings.php and constantly rebase the patch, this new file can just be dropped in. Since this runs before LocalSettings.php, users can still override these settings if they want to do so.

Idea 2
This was originally suggested by Krinkle. Have the packager override the LocalSettingsGenerator, and at the top of the generated LocalSettings.php add (for example).

This has the benefit of not requiring any changes to MediaWiki core since it can be implemented with the existing installer overrides system. The only downside is that once this is implemented, people with existing MediaWiki installs need to add that line to their LocalSettings.php, but that's a one time cost, and is acceptable.