Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4047606
LuaTitleBlacklistLibrary.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
LuaTitleBlacklistLibrary.php
View Options
<?php
namespace
MediaWiki\Extension\TitleBlacklist
;
use
MediaWiki\Extension\Scribunto\Engines\LuaCommon\LibraryBase
;
use
MediaWiki\Extension\Scribunto\Engines\LuaCommon\LuaError
;
use
MediaWiki\MediaWikiServices
;
class
LuaTitleBlacklistLibrary
extends
LibraryBase
{
/** @inheritDoc */
public
function
register
()
{
$lib
=
[
'test'
=>
[
$this
,
'test'
],
];
return
$this
->
getEngine
()->
registerInterface
(
__DIR__
.
'/mw.ext.TitleBlacklist.lua'
,
$lib
,
[]
);
}
/**
* @param string|null $action
* @param string|null $title
* @return null[]|array[]
* @throws LuaError If the expensive function count has been exceeded
*/
public
function
test
(
$action
=
null
,
$title
=
null
)
{
$this
->
checkType
(
'mw.ext.TitleBlacklist.test'
,
1
,
$action
,
'string'
);
$this
->
checkTypeOptional
(
'mw.ext.TitleBlacklist.test'
,
2
,
$title
,
'string'
,
''
);
$this
->
incrementExpensiveFunctionCount
();
if
(
$title
==
''
)
{
$page
=
$this
->
getParser
()->
getPage
();
if
(
!
$page
)
{
// Nothing to check
return
[
null
];
}
$title
=
MediaWikiServices
::
getInstance
()->
getTitleFormatter
()->
getPrefixedText
(
$page
);
}
$entry
=
TitleBlacklist
::
singleton
()->
isBlacklisted
(
$title
,
$action
);
// check if not whitelisted
$whitelist
=
TitleBlacklist
::
singleton
()->
isWhitelisted
(
$title
,
$action
);
if
(
$whitelist
)
{
// page is whitelisted, don't continue and return a null object
return
[
null
];
}
if
(
$entry
)
{
return
[
[
'params'
=>
$entry
->
getParams
(),
'regex'
=>
$entry
->
getRegex
(),
'raw'
=>
$entry
->
getRaw
(),
'version'
=>
$entry
->
getFormatVersion
(),
'message'
=>
$entry
->
getErrorMessage
(
$action
),
'custommessage'
=>
$entry
->
getCustomMessage
()
]
];
}
return
[
null
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 15 2026, 12:36 (13 w, 10 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
70/62/4ba2aed0d1154589225285bb254f
Default Alt Text
LuaTitleBlacklistLibrary.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment