MediaWiki REL1_34
|
Utility class for working with blacklists. More...
Static Public Member Functions | |
static | getBadLines ( $lines, BaseBlacklist $blacklist) |
Returns an array of invalid lines. | |
static | regexesFromMessage ( $message, BaseBlacklist $blacklist) |
Build a set of regular expressions from a MediaWiki message. | |
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. | |
Static Private Member Functions | |
static | buildRegexes ( $lines, BaseBlacklist $blacklist, $batchSize=4096) |
Build a set of regular expressions matching URLs with the list of regex fragments. | |
static | buildSafeRegexes ( $lines, BaseBlacklist $blacklist, $fileName=false) |
Do a sanity check on the batch regex. | |
static | stripLines ( $lines) |
Strip comments and whitespace, then remove blanks. | |
static | validateRegexes ( $regexes) |
Confirm that a set of regexes is either empty or valid. | |
Utility class for working with blacklists.
Definition at line 6 of file SpamRegexBatch.php.
|
staticprivate |
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, BaseBlacklist\getRegexEnd(), and BaseBlacklist\getRegexStart().
Referenced by buildSafeRegexes(), and getBadLines().
|
staticprivate |
Do a sanity check on the batch regex.
array | $lines | unsanitized input lines |
BaseBlacklist | $blacklist | |
bool | string | $fileName | optional for debug reporting |
Definition at line 96 of file SpamRegexBatch.php.
References $lines, buildRegexes(), stripLines(), and wfDebugLog().
Referenced by regexesFromText().
|
static |
Returns an array of invalid lines.
array | $lines | |
BaseBlacklist | $blacklist |
Definition at line 119 of file SpamRegexBatch.php.
References $line, $lines, 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.
string | $message | |
BaseBlacklist | $blacklist |
Definition at line 168 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.
string | $source | |
BaseBlacklist | $blacklist | |
bool | string | $fileName | optional, for reporting of bad files |
Definition at line 155 of file SpamRegexBatch.php.
References $lines, $source, and buildSafeRegexes().
Referenced by BaseBlacklist\buildSharedBlacklists(), and regexesFromMessage().
|
staticprivate |
Strip comments and whitespace, then remove blanks.
array | $lines |
Definition at line 81 of file SpamRegexBatch.php.
References $lines.
Referenced by buildSafeRegexes(), and getBadLines().
|
staticprivate |
Confirm that a set of regexes is either empty or valid.
array | $regexes | set of regexes |
Definition at line 61 of file SpamRegexBatch.php.