From: Kunal Mehta Date: Mon, 2 Apr 2018 22:27:18 +0000 (-0700) Subject: installer: Add support for PlatformSettings.php X-Git-Tag: 1.31.0-rc.0~145^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=50212e6d0ef2cdcc63aece18c8d77c9c251be7ed installer: Add support for PlatformSettings.php PlatformSettings.php is a standardized and recommended way for re-distributors and packagers of MediaWiki to be able to tune DefaultSettings.php as appropriate. If includes/PlatformSettings.php exists, the installer will automatically include it as part of the generated LocalSettings.php. The main advantage of this system is that if the distributor wants to change the default settings, all users will benefit immediately. And if people want a vanilla MediaWiki experience, they can just remove the inclusion from their LocalSettings.php. This RfC () was approved by TechCom. Bug: T182020 Change-Id: I34f9a4acbe86b9c5c80ac16451b317ce5f6640f9 --- diff --git a/docs/distributors.txt b/docs/distributors.txt index 758111009f..729dffa3a1 100644 --- a/docs/distributors.txt +++ b/docs/distributors.txt @@ -87,10 +87,15 @@ which the user can edit by hand thereafter. It's just a plain old PHP file, and can contain any PHP statements. It usually sets global variables that are used for configuration, and includes files used by any extensions. -Distributors can easily change the installer behavior, including LocalSettings -generated, by placing their overrides into mw-config/overrides directory. Doing -that is highly preferred to modifying MediaWiki code directly. See -mw-config/overrides/README for more details and examples. +Distributors can easily change the default settings by creating +includes/PlatformSettings.php with overrides/additions to the default settings. +The installer will automatically include the platform defaults when generating +the user's LocalSettings.php file. + +Furthermore, distributors can change the installer behavior, by placing their +overrides into mw-config/overrides directory. Doing that is highly preferred +to modifying MediaWiki code directly. See mw-config/overrides/README for more +details and examples. There's a new maintenance/install.php script which could be used for performing an install through the command line. diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index b4ef49d7c6..6d70338cf9 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -299,6 +299,12 @@ class LocalSettingsGenerator { } $mcservers = $this->buildMemcachedServerList(); + if ( file_exists( dirname( __DIR__ ) . '/PlatformSettings.php' ) ) { + $platformSettings = "\n## Include platform/distribution defaults"; + $platformSettings .= "\nrequire_once \"\$IP/includes/PlatformSettings.php\";"; + } else { + $platformSettings = ''; + } return "