Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
InstallerOverrides | |
0.00% |
0 / 17 |
|
0.00% |
0 / 4 |
42 | |
0.00% |
0 / 1 |
getOverrides | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
12 | |||
getLocalSettingsGenerator | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getWebInstaller | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getCliInstaller | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * MediaWiki installer overrides. See mw-config/overrides/README for details. |
5 | * |
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. |
10 | * |
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. |
15 | * |
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 |
20 | * |
21 | * @file |
22 | */ |
23 | |
24 | namespace MediaWiki\Installer; |
25 | |
26 | use MediaWiki\Request\WebRequest; |
27 | |
28 | /** |
29 | * @since 1.20 |
30 | */ |
31 | class InstallerOverrides { |
32 | private static function getOverrides() { |
33 | static $overrides; |
34 | |
35 | if ( !$overrides ) { |
36 | $overrides = [ |
37 | 'LocalSettingsGenerator' => LocalSettingsGenerator::class, |
38 | 'WebInstaller' => WebInstaller::class, |
39 | 'CliInstaller' => CliInstaller::class, |
40 | ]; |
41 | foreach ( glob( MW_INSTALL_PATH . '/mw-config/overrides/*.php' ) as $file ) { |
42 | require $file; |
43 | } |
44 | } |
45 | |
46 | return $overrides; |
47 | } |
48 | |
49 | /** |
50 | * Instantiates and returns an instance of LocalSettingsGenerator or its descendant classes |
51 | * @param Installer $installer |
52 | * @return LocalSettingsGenerator |
53 | */ |
54 | public static function getLocalSettingsGenerator( Installer $installer ) { |
55 | $className = self::getOverrides()['LocalSettingsGenerator']; |
56 | return new $className( $installer ); |
57 | } |
58 | |
59 | /** |
60 | * Instantiates and returns an instance of WebInstaller or its descendant classes |
61 | * @param WebRequest $request |
62 | * @return WebInstaller |
63 | */ |
64 | public static function getWebInstaller( WebRequest $request ) { |
65 | $className = self::getOverrides()['WebInstaller']; |
66 | return new $className( $request ); |
67 | } |
68 | |
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 |
75 | */ |
76 | public static function getCliInstaller( $siteName, $admin = null, array $options = [] ) { |
77 | $className = self::getOverrides()['CliInstaller']; |
78 | return new $className( $siteName, $admin, $options ); |
79 | } |
80 | } |