Replace deprecated Hooks::run

Bug: T335536
Change-Id: I6968c26df6819f0c83105e92c03d1d204f90db27
(cherry picked from commit 35660f4e78)
This commit is contained in:
Umherirrender 2023-05-06 23:11:13 +02:00
parent 79285fbb6a
commit 5888ec9f29
2 changed files with 12 additions and 5 deletions

View file

@ -39,7 +39,8 @@
"class": "MediaWiki\\Extension\\Math\\HookHandlers\\ParserHooksHandler",
"services": [
"Math.RendererFactory",
"UserOptionsLookup"
"UserOptionsLookup",
"HookContainer"
]
},
"PreferencesHooksHandler": {

View file

@ -3,7 +3,6 @@
namespace MediaWiki\Extension\Math\HookHandlers;
use FatalError;
use Hooks as MWHooks;
use MediaWiki\Extension\Math\MathConfig;
use MediaWiki\Extension\Math\MathMathML;
use MediaWiki\Extension\Math\MathMathMLCli;
@ -12,6 +11,7 @@ use MediaWiki\Extension\Math\Render\RendererFactory;
use MediaWiki\Hook\ParserAfterTidyHook;
use MediaWiki\Hook\ParserFirstCallInitHook;
use MediaWiki\Hook\ParserOptionsRegisterHook;
use MediaWiki\HookContainer\HookContainer;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\User\UserOptionsLookup;
use MWException;
@ -39,16 +39,22 @@ class ParserHooksHandler implements
/** @var UserOptionsLookup */
private $userOptionsLookup;
/** @var HookContainer */
private $hookContainer;
/**
* @param RendererFactory $rendererFactory
* @param UserOptionsLookup $userOptionsLookup
* @param HookContainer $hookContainer
*/
public function __construct(
RendererFactory $rendererFactory,
UserOptionsLookup $userOptionsLookup
UserOptionsLookup $userOptionsLookup,
HookContainer $hookContainer
) {
$this->rendererFactory = $rendererFactory;
$this->userOptionsLookup = $userOptionsLookup;
$this->hookContainer = $hookContainer;
}
/**
@ -133,8 +139,8 @@ class ParserHooksHandler implements
$renderer->addTrackingCategories( $parser );
return $renderer->getLastError();
}
// TODO: Convert to a new style hook system and inject HookContainer
MWHooks::run( 'MathFormulaPostRender',
// TODO: Convert to a new style hook system
$this->hookContainer->run( 'MathFormulaPostRender',
[ $parser, $renderer, &$renderedMath ]
); // Enables indexing of math formula