Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / installer / InstallerOverrides.php
blobb476479b7971a099158d067bcbae2bf03820bdf4
1 <?php
3 /**
4 * MediaWiki installer overrides. See mw-config/overrides/README for details.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
21 * @file
24 namespace MediaWiki\Installer;
26 use MediaWiki\Request\WebRequest;
28 /**
29 * @since 1.20
31 class InstallerOverrides {
32 private static function getOverrides() {
33 static $overrides;
35 if ( !$overrides ) {
36 $overrides = [
37 'LocalSettingsGenerator' => LocalSettingsGenerator::class,
38 'WebInstaller' => WebInstaller::class,
39 'CliInstaller' => CliInstaller::class,
41 foreach ( glob( MW_INSTALL_PATH . '/mw-config/overrides/*.php' ) as $file ) {
42 require $file;
46 return $overrides;
49 /**
50 * Instantiates and returns an instance of LocalSettingsGenerator or its descendant classes
51 * @param Installer $installer
52 * @return LocalSettingsGenerator
54 public static function getLocalSettingsGenerator( Installer $installer ) {
55 $className = self::getOverrides()['LocalSettingsGenerator'];
56 return new $className( $installer );
59 /**
60 * Instantiates and returns an instance of WebInstaller or its descendant classes
61 * @param WebRequest $request
62 * @return WebInstaller
64 public static function getWebInstaller( WebRequest $request ) {
65 $className = self::getOverrides()['WebInstaller'];
66 return new $className( $request );
69 /**
70 * Instantiates and returns an instance of CliInstaller or its descendant classes
71 * @param string $siteName
72 * @param string|null $admin
73 * @param array $options
74 * @return CliInstaller
76 public static function getCliInstaller( $siteName, $admin = null, array $options = [] ) {
77 $className = self::getOverrides()['CliInstaller'];
78 return new $className( $siteName, $admin, $options );