MediaWiki
1.30.0
|
Utility class for working with blacklists. More...
Static Public Member Functions | |
static | buildRegexes ( $lines, BaseBlacklist $blacklist, $batchSize=4096) |
Build a set of regular expressions matching URLs with the list of regex fragments. More... | |
static | buildSafeRegexes ( $lines, BaseBlacklist $blacklist, $fileName=false) |
Do a sanity check on the batch regex. More... | |
static | getBadLines ( $lines, BaseBlacklist $blacklist) |
Returns an array of invalid lines. More... | |
static | regexesFromMessage ( $message, BaseBlacklist $blacklist) |
Build a set of regular expressions from a MediaWiki message. More... | |
static | regexesFromText ( $source, BaseBlacklist $blacklist, $fileName=false) |
Build a set of regular expressions from the given multiline input text, with empty lines and comments stripped. More... | |
static | stripLines ( $lines) |
Strip comments and whitespace, then remove blanks. More... | |
static | validateRegexes ( $regexes) |
Confirm that a set of regexes is either empty or valid. More... | |
Utility class for working with blacklists.
Definition at line 6 of file SpamRegexBatch.php.
|
static |
Build a set of regular expressions matching URLs with the list of regex fragments.
Returns an empty list if the input list is empty.
array | $lines | list of fragments which will match in URLs |
BaseBlacklist | $blacklist | |
int | $batchSize | largest allowed batch regex; if 0, will produce one regex per line |
Definition at line 17 of file SpamRegexBatch.php.
References $line, $lines, $regexes, as, BaseBlacklist\getRegexEnd(), and BaseBlacklist\getRegexStart().
Referenced by buildSafeRegexes(), and getBadLines().
|
static |
Do a sanity check on the batch regex.
$lines | string unsanitized input lines |
$blacklist | BaseBlacklist |
$fileName | bool|string optional for debug reporting |
Definition at line 95 of file SpamRegexBatch.php.
References $lines, $regexes, buildRegexes(), stripLines(), and wfDebugLog().
Referenced by regexesFromText().
|
static |
Returns an array of invalid lines.
array | $lines | |
$blacklist | BaseBlacklist |
Definition at line 118 of file SpamRegexBatch.php.
References $line, $lines, $regexes, as, buildRegexes(), and stripLines().
Referenced by SpamBlacklistHooks\validate().
|
static |
Build a set of regular expressions from a MediaWiki message.
Will be correctly empty if the message isn't present.
$message | string |
$blacklist | BaseBlacklist |
Definition at line 167 of file SpamRegexBatch.php.
References $source, regexesFromText(), and wfMessage().
Referenced by BaseBlacklist\getLocalBlacklists(), and BaseBlacklist\getWhitelists().
|
static |
Build a set of regular expressions from the given multiline input text, with empty lines and comments stripped.
$source | string |
$blacklist | BaseBlacklist |
$fileName | bool|string optional, for reporting of bad files |
Definition at line 154 of file SpamRegexBatch.php.
References $lines, $source, and buildSafeRegexes().
Referenced by BaseBlacklist\buildSharedBlacklists(), and regexesFromMessage().
|
static |
Strip comments and whitespace, then remove blanks.
$lines | array |
Definition at line 80 of file SpamRegexBatch.php.
References $lines.
Referenced by buildSafeRegexes(), and getBadLines().
|
static |
Confirm that a set of regexes is either empty or valid.
$regexes | array set of regexes |
Definition at line 61 of file SpamRegexBatch.php.
References $regexes, as, wfRestoreWarnings(), and wfSuppressWarnings().