diff --git a/extension.json b/extension.json index 9e69d038..36ae03ce 100644 --- a/extension.json +++ b/extension.json @@ -33,7 +33,7 @@ "Hooks": { "ParserTestGlobals": "ParserFunctionsHookHandler", "ParserFirstCallInit": "ParserFunctionsHookHandler", - "ScribuntoExternalLibraries": "MediaWiki\\Extension\\ParserFunctions\\Hooks::onScribuntoExternalLibraries" + "ScribuntoExternalLibraries": "ParserFunctionsScribuntoHookHandler" }, "HookHandlers": { "ParserFunctionsHookHandler": { @@ -41,6 +41,9 @@ "services": [ "MainConfig" ] + }, + "ParserFunctionsScribuntoHookHandler": { + "class": "MediaWiki\\Extension\\ParserFunctions\\ScribuntoHooks" } }, "AutoloadNamespaces": { diff --git a/includes/Hooks.php b/includes/Hooks.php index 29bc7376..e216ca11 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -67,18 +67,4 @@ class Hooks implements $parser->setFunctionHook( 'urldecode', [ ParserFunctions::class, 'runUrlDecode' ] ); } } - - /** - * Registers ParserFunctions' lua function with Scribunto - * - * @see https://www.mediawiki.org/wiki/Extension:Scribunto/ScribuntoExternalLibraries - * - * @param string $engine - * @param string[] &$extraLibraries - */ - public static function onScribuntoExternalLibraries( $engine, array &$extraLibraries ) { - if ( $engine === 'lua' ) { - $extraLibraries['mw.ext.ParserFunctions'] = LuaLibrary::class; - } - } } diff --git a/includes/ScribuntoHooks.php b/includes/ScribuntoHooks.php new file mode 100644 index 00000000..bcfa6ef6 --- /dev/null +++ b/includes/ScribuntoHooks.php @@ -0,0 +1,26 @@ +