Skip to content

Commit

Permalink
Replace deprecated wgHooks (#77)
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
paladox authored Feb 9, 2025
1 parent 9c9e258 commit 3dc143b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions SemanticCompoundQueries.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use MediaWiki\MediaWikiServices;

/**
* @see https://github.com/SemanticMediaWiki/SemanticCompoundQueries/
*
Expand Down Expand Up @@ -63,12 +65,13 @@ public static function onExtensionFunction() {
$GLOBALS['wgAPIModules']['compoundquery'] = 'SCQ\Api\CompoundQuery';

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

// always return true, in order not to stop MW's hook processing!
return true;
};
} );
}

/**
Expand Down

0 comments on commit 3dc143b

Please sign in to comment.