Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
ConfigHookHandler | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 1 |
onMediaWikiServices | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | /** |
3 | * © 2006-2008 Daniel Kinzler and others |
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 | * @ingroup Extensions |
22 | * @author Daniel Kinzler, brightbyte.de |
23 | */ |
24 | |
25 | namespace MediaWiki\Extension\CategoryTree; |
26 | |
27 | use MediaWiki\Hook\MediaWikiServicesHook; |
28 | use MediaWiki\MediaWikiServices; |
29 | |
30 | /** |
31 | * Hook handler for manipulating configuration. |
32 | * |
33 | * @note This hook runs before the service container is fully initialized, so it cannot have |
34 | * services injected. For this reason, it needs to be separate from the handlers for other |
35 | * hooks. |
36 | */ |
37 | class ConfigHookHandler implements MediaWikiServicesHook { |
38 | |
39 | /** |
40 | * Adjusts config once MediaWiki is fully initialised |
41 | * TODO: Don't do this, lazy initialize the config |
42 | * @param MediaWikiServices $services |
43 | */ |
44 | public function onMediaWikiServices( $services ) { |
45 | global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode; |
46 | global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode; |
47 | global $wgCategoryTreeOmitNamespace; |
48 | |
49 | if ( !isset( $wgCategoryTreeDefaultOptions['mode'] ) ) { |
50 | $wgCategoryTreeDefaultOptions['mode'] = $wgCategoryTreeDefaultMode; |
51 | } |
52 | |
53 | if ( !isset( $wgCategoryTreeDefaultOptions['hideprefix'] ) ) { |
54 | $wgCategoryTreeDefaultOptions['hideprefix'] = $wgCategoryTreeOmitNamespace; |
55 | } |
56 | |
57 | if ( !isset( $wgCategoryTreeCategoryPageOptions['mode'] ) ) { |
58 | $wgCategoryTreeCategoryPageOptions['mode'] = $wgCategoryTreeCategoryPageMode; |
59 | } |
60 | } |
61 | |
62 | } |