Skip to content

Commit 3dc143b

Browse files
authored
Replace deprecated wgHooks (#77)
Fixes #76
1 parent 9c9e258 commit 3dc143b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

SemanticCompoundQueries.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use MediaWiki\MediaWikiServices;
4+
35
/**
46
* @see https://github.com/SemanticMediaWiki/SemanticCompoundQueries/
57
*
@@ -63,12 +65,13 @@ public static function onExtensionFunction() {
6365
$GLOBALS['wgAPIModules']['compoundquery'] = 'SCQ\Api\CompoundQuery';
6466

6567
// wgHooks
66-
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = function( Parser &$parser ) {
68+
$hookContainer = MediaWikiServices::getInstance()->getHookContainer();
69+
$hookContainer->register( 'ParserFirstCallInit', function( Parser &$parser ) {
6770
$parser->setFunctionHook( 'compound_query', [ '\SCQ\CompoundQueryProcessor', 'doCompoundQuery' ] );
6871

6972
// always return true, in order not to stop MW's hook processing!
7073
return true;
71-
};
74+
} );
7275
}
7376

7477
/**

0 commit comments

Comments
 (0)