1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* MediaWiki installer overrides. See mw-config/overrides/README for details. |
4
|
|
|
* |
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. |
9
|
|
|
* |
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. |
14
|
|
|
* |
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 |
19
|
|
|
* |
20
|
|
|
* @file |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @since 1.20 |
25
|
|
|
*/ |
26
|
|
|
class InstallerOverrides { |
27
|
|
|
private static function getOverrides() { |
28
|
|
|
global $IP; |
29
|
|
|
static $overrides; |
30
|
|
|
|
31
|
|
|
if ( !$overrides ) { |
32
|
|
|
$overrides = [ |
33
|
|
|
'LocalSettingsGenerator' => 'LocalSettingsGenerator', |
34
|
|
|
'WebInstaller' => 'WebInstaller', |
35
|
|
|
'CliInstaller' => 'CliInstaller', |
36
|
|
|
]; |
37
|
|
|
foreach ( glob( "$IP/mw-config/overrides/*.php" ) as $file ) { |
38
|
|
|
require $file; |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
return $overrides; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Instantiates and returns an instance of LocalSettingsGenerator or its descendant classes |
47
|
|
|
* @param Installer $installer |
48
|
|
|
* @return LocalSettingsGenerator |
49
|
|
|
*/ |
50
|
|
|
public static function getLocalSettingsGenerator( Installer $installer ) { |
51
|
|
|
$className = self::getOverrides()['LocalSettingsGenerator']; |
52
|
|
|
return new $className( $installer ); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Instantiates and returns an instance of WebInstaller or its descendant classes |
57
|
|
|
* @param WebRequest $request |
58
|
|
|
* @return WebInstaller |
59
|
|
|
*/ |
60
|
|
|
public static function getWebInstaller( WebRequest $request ) { |
61
|
|
|
$className = self::getOverrides()['WebInstaller']; |
62
|
|
|
return new $className( $request ); |
63
|
|
|
} |
64
|
|
|
|
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 |
71
|
|
|
*/ |
72
|
|
|
public static function getCliInstaller( $siteName, $admin = null, array $options = [] ) { |
73
|
|
|
$className = self::getOverrides()['CliInstaller']; |
74
|
|
|
return new $className( $siteName, $admin, $options ); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|