diff --git a/mediawiki/includes/BootstrapHelperFunctions.php b/mediawiki/includes/BootstrapHelperFunctions.php index c8dc6f940..bf9ae66c0 100644 --- a/mediawiki/includes/BootstrapHelperFunctions.php +++ b/mediawiki/includes/BootstrapHelperFunctions.php @@ -41,7 +41,7 @@ function wfDetectLocalSettingsFile( ?string $installationPath = null ): string { // place is dangerous, so better not to encourage that. // In order to use LocalSettings.yaml and LocalSettings.json, they // will have to be referenced explicitly by MW_CONFIG_FILE. - $configFile = getenv( 'MW_CONFIG_FILE' ) ?: "LocalSettings.php"; + $configFile = getenv( 'MW_CONFIG_FILE' ) ?: "$installationPath/config/LocalSettings.php"; // Can't use str_contains because for maintenance scripts (update.php, install.php), // this is called *before* Setup.php and vendor (polyfill-php80) are included. if ( strpos( $configFile, '/' ) === false ) { diff --git a/mediawiki/includes/Setup.php b/mediawiki/includes/Setup.php index 003544c72..4ce788a43 100644 --- a/mediawiki/includes/Setup.php +++ b/mediawiki/includes/Setup.php @@ -207,6 +207,16 @@ try { // make defaults available as globals $wgSettings->apply(); require_once MW_CONFIG_FILE; + + // ALT specific loading configs from packages + // Include all PHP files in config/LocalSettings.d/ directory + $configDir = preg_replace('/(.*).php/', '$1.d', MW_CONFIG_FILE); + if (is_dir($configDir)) { + foreach (glob($configDir . "/*.php") as $d_config) { + require_once($d_config); + } + } + } else { $wgSettings->loadFile( MW_CONFIG_FILE ); }