mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-23 21:53:40 +00:00
Use HookHandlers for Scribunto hook
Bug: T271033 Change-Id: I486bf703a73d6196c7bb840ac37b290615c548e7
This commit is contained in:
parent
0e14a1b4f3
commit
319b33cb46
|
@ -91,11 +91,14 @@
|
|||
"MovePageCheckPermissions": "TitleBlacklistHookHandler",
|
||||
"EditFilter": "TitleBlacklistHookHandler",
|
||||
"PageSaveComplete": "TitleBlacklistHookHandler",
|
||||
"ScribuntoExternalLibraries": "MediaWiki\\Extension\\TitleBlacklist\\Hooks::onScribuntoExternalLibraries"
|
||||
"ScribuntoExternalLibraries": "TitleBlacklistScribuntoHookHandler"
|
||||
},
|
||||
"HookHandlers": {
|
||||
"TitleBlacklistHookHandler": {
|
||||
"class": "MediaWiki\\Extension\\TitleBlacklist\\Hooks"
|
||||
},
|
||||
"TitleBlacklistScribuntoHookHandler": {
|
||||
"class": "MediaWiki\\Extension\\TitleBlacklist\\ScribuntoHooks"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
|
|
|
@ -282,16 +282,4 @@ class Hooks implements
|
|||
$logEntry->publish( $logid );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* External Lua library for Scribunto
|
||||
*
|
||||
* @param string $engine
|
||||
* @param array &$extraLibraries
|
||||
*/
|
||||
public static function onScribuntoExternalLibraries( $engine, array &$extraLibraries ) {
|
||||
if ( $engine == 'lua' ) {
|
||||
$extraLibraries['mw.ext.TitleBlacklist'] = Scribunto_LuaTitleBlacklistLibrary::class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
26
includes/ScribuntoHooks.php
Normal file
26
includes/ScribuntoHooks.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace MediaWiki\Extension\TitleBlacklist;
|
||||
|
||||
use MediaWiki\Extension\Scribunto\Hooks\ScribuntoExternalLibrariesHook;
|
||||
|
||||
/**
|
||||
* Hooks from Scribunto extension,
|
||||
* which is optional to use with this extension.
|
||||
*
|
||||
* @ingroup Extensions
|
||||
*/
|
||||
class ScribuntoHooks implements ScribuntoExternalLibrariesHook {
|
||||
|
||||
/**
|
||||
* External Lua library for Scribunto
|
||||
*
|
||||
* @param string $engine
|
||||
* @param array &$extraLibraries
|
||||
*/
|
||||
public function onScribuntoExternalLibraries( string $engine, array &$extraLibraries ) {
|
||||
if ( $engine === 'lua' ) {
|
||||
$extraLibraries['mw.ext.TitleBlacklist'] = Scribunto_LuaTitleBlacklistLibrary::class;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue