Added release notes for 'ContentHandler::runLegacyHooks' removal
[mediawiki.git] / includes / installer / InstallerOverrides.php
blobeba3a20d6c1ae1e8f7c76d18c4bd439327265efc
1 <?php
2 /**
3 * MediaWiki installer overrides. See mw-config/overrides/README for details.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
23 /**
24 * @since 1.20
26 class InstallerOverrides {
27 private static function getOverrides() {
28 global $IP;
29 static $overrides;
31 if ( !$overrides ) {
32 $overrides = [
33 'LocalSettingsGenerator' => 'LocalSettingsGenerator',
34 'WebInstaller' => 'WebInstaller',
35 'CliInstaller' => 'CliInstaller',
37 foreach ( glob( "$IP/mw-config/overrides/*.php" ) as $file ) {
38 require $file;
42 return $overrides;
45 /**
46 * Instantiates and returns an instance of LocalSettingsGenerator or its descendant classes
47 * @param Installer $installer
48 * @return LocalSettingsGenerator
50 public static function getLocalSettingsGenerator( Installer $installer ) {
51 $className = self::getOverrides()['LocalSettingsGenerator'];
52 return new $className( $installer );
55 /**
56 * Instantiates and returns an instance of WebInstaller or its descendant classes
57 * @param WebRequest $request
58 * @return WebInstaller
60 public static function getWebInstaller( WebRequest $request ) {
61 $className = self::getOverrides()['WebInstaller'];
62 return new $className( $request );
65 /**
66 * Instantiates and returns an instance of CliInstaller or its descendant classes
67 * @param string $siteName
68 * @param string|null $admin
69 * @param array $options
70 * @return CliInstaller
72 public static function getCliInstaller( $siteName, $admin = null, array $options = [] ) {
73 $className = self::getOverrides()['CliInstaller'];
74 return new $className( $siteName, $admin, $options );