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
24 namespace MediaWiki\Installer
;
26 use MediaWiki\Request\WebRequest
;
31 class InstallerOverrides
{
32 private static function getOverrides() {
37 'LocalSettingsGenerator' => LocalSettingsGenerator
::class,
38 'WebInstaller' => WebInstaller
::class,
39 'CliInstaller' => CliInstaller
::class,
41 foreach ( glob( MW_INSTALL_PATH
. '/mw-config/overrides/*.php' ) as $file ) {
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 );
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 );
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 );