MediaWiki REL1_33
|
Base class for different kinds of blacklists. More...
Public Member Functions | |
__construct ( $settings=[]) | |
Constructor. | |
clearCache () | |
Clear all primary blacklist cache keys. | |
filter (array $links, Title $title, $preventLog=false) | |
getBlacklists () | |
Fetch local and (possibly cached) remote blacklists. | |
getLocalBlacklists () | |
Returns the local blacklist. | |
getRegexEnd ( $batchSize) | |
Returns the end of the regex for matches. | |
getRegexStart () | |
Returns the start of the regex for matches. | |
getWhitelists () | |
Returns the (local) whitelist. | |
warmCachesForFilter (Title $title, array $entries) | |
Static Public Member Functions | |
static | addBlacklistType ( $type, $class) |
Adds a blacklist class to the registry. | |
static | getBlacklistTypes () |
Return the array of blacklist types currently defined. | |
static | getEmailBlacklist () |
static | getInstance ( $type) |
Returns an instance of the given blacklist. | |
static | getSpamBlacklist () |
static | getTypeFromTitle (Title $title) |
Returns the type of blacklist from the given title. | |
static | isLocalSource (Title $title) |
Check if the given local page title is a spam regex source. | |
Public Attributes | |
int | $expiryTime = 900 |
array | $files = [] |
Array of blacklist sources. | |
int | $warningChance = 100 |
Chance of receiving a warning when the filter is hit. | |
int | $warningTime = 600 |
Protected Member Functions | |
getBlacklistType () | |
Returns the code for the blacklist implementation. | |
Protected Attributes | |
bool array | $regexes = false |
Array containing regexes to test against. | |
Private Member Functions | |
buildSharedBlacklists () | |
getArticleText ( $wiki, $article) | |
Fetch an article from this or another local MediaWiki database. | |
getHttpText ( $fileName) | |
getSharedBlacklists () | |
Fetch (possibly cached) remote blacklists. | |
Static Private Attributes | |
static array | $blacklistTypes |
Array containing blacklists that extend BaseBlacklist. | |
static array | $instances = [] |
Array of blacklist instances. | |
Base class for different kinds of blacklists.
Definition at line 6 of file BaseBlacklist.php.
BaseBlacklist::__construct | ( | $settings = [] | ) |
Constructor.
array | $settings |
Definition at line 60 of file BaseBlacklist.php.
References $value.
|
static |
Adds a blacklist class to the registry.
string | $type | |
string | $class |
Definition at line 80 of file BaseBlacklist.php.
References $type.
|
private |
Definition at line 320 of file BaseBlacklist.php.
References $matches, $regexes, and(), files, getArticleText(), getBlacklistType(), getHttpText(), SpamRegexBatch\regexesFromText(), and wfDebugLog().
BaseBlacklist::clearCache | ( | ) |
Clear all primary blacklist cache keys.
Definition at line 309 of file BaseBlacklist.php.
References $cache, getBlacklistType(), and wfDebugLog().
|
private |
Fetch an article from this or another local MediaWiki database.
This is probably very fragile, and shouldn't be used perhaps.
string | $wiki | |
string | $article |
Definition at line 386 of file BaseBlacklist.php.
References $article, $revQuery, and(), DB_REPLICA, Revision\getQueryInfo(), Revision\newFromRow(), Revision\selectFields(), Revision\selectPageFields(), Revision\selectTextFields(), wfDebugLog(), and wfGetDB().
Referenced by buildSharedBlacklists().
BaseBlacklist::getBlacklists | ( | ) |
Fetch local and (possibly cached) remote blacklists.
Will be cached locally across multiple invocations.
Definition at line 220 of file BaseBlacklist.php.
References $regexes, and(), getLocalBlacklists(), and getSharedBlacklists().
Referenced by EmailBlacklist\checkUser(), and SpamBlacklist\filter().
|
abstractprotected |
Returns the code for the blacklist implementation.
Reimplemented in EmailBlacklist, and SpamBlacklist.
Referenced by buildSharedBlacklists(), clearCache(), getHttpText(), getLocalBlacklists(), getSharedBlacklists(), and getWhitelists().
|
static |
Return the array of blacklist types currently defined.
Definition at line 89 of file BaseBlacklist.php.
References $blacklistTypes.
Referenced by SpamBlacklistHooks\pageSaveContent().
|
static |
Definition at line 103 of file BaseBlacklist.php.
References getInstance().
Referenced by SpamBlacklistPreAuthenticationProvider\testForAccountCreation(), and SpamBlacklistHooks\userCanSendEmail().
|
private |
Definition at line 348 of file BaseBlacklist.php.
References $messageMemc, $wgDBname, and(), Http\get(), getBlacklistType(), and wfDebugLog().
Referenced by buildSharedBlacklists().
|
static |
Returns an instance of the given blacklist.
string | $type | Code for the blacklist |
Exception |
Definition at line 115 of file BaseBlacklist.php.
Referenced by ApiSpamBlacklist\execute(), getEmailBlacklist(), getSpamBlacklist(), SpamBlacklistHooks\pageSaveContent(), SpamBlacklistTest\setUp(), and SpamBlacklistHooks\validate().
BaseBlacklist::getLocalBlacklists | ( | ) |
Returns the local blacklist.
Definition at line 234 of file BaseBlacklist.php.
References $cache, $type, and(), function, getBlacklistType(), and SpamRegexBatch\regexesFromMessage().
Referenced by getBlacklists().
BaseBlacklist::getRegexEnd | ( | $batchSize | ) |
Returns the end of the regex for matches.
int | $batchSize |
Reimplemented in SpamBlacklist.
Definition at line 441 of file BaseBlacklist.php.
Referenced by SpamRegexBatch\buildRegexes().
BaseBlacklist::getRegexStart | ( | ) |
Returns the start of the regex for matches.
Reimplemented in SpamBlacklist.
Definition at line 431 of file BaseBlacklist.php.
Referenced by SpamRegexBatch\buildRegexes().
|
private |
Fetch (possibly cached) remote blacklists.
Definition at line 271 of file BaseBlacklist.php.
References $cache, $regexes, and(), files, function, getBlacklistType(), and wfDebugLog().
Referenced by getBlacklists().
|
static |
Definition at line 96 of file BaseBlacklist.php.
References getInstance().
Referenced by Cleanup\execute(), SpamBlacklistHooks\filterMergedContent(), SpamBlacklistHooks\onArticleDelete(), SpamBlacklistHooks\onArticleDeleteComplete(), SpamBlacklistHooks\onParserOutputStashForEdit(), SpamBlacklistHooks\onUploadVerifyUpload(), and SpamBlacklistHooks\pageSaveContent().
|
static |
Returns the type of blacklist from the given title.
Title | $title |
Definition at line 202 of file BaseBlacklist.php.
References $wgContLang, and and().
Referenced by BaseBlacklistTest\testGetTypeFromTitle(), and SpamBlacklistHooks\validate().
BaseBlacklist::getWhitelists | ( | ) |
Returns the (local) whitelist.
Definition at line 253 of file BaseBlacklist.php.
References $cache, $type, and(), function, getBlacklistType(), and SpamRegexBatch\regexesFromMessage().
Referenced by EmailBlacklist\checkUser(), and SpamBlacklist\filter().
|
static |
Check if the given local page title is a spam regex source.
Title | $title |
Definition at line 148 of file BaseBlacklist.php.
References $files, $matches, $type, $wgDBname, and(), PROTO_HTTP, and wfExpandUrl().
Referenced by SpamBlacklistHooks\pageSaveContent(), and SpamBlacklistHooks\validate().
Title | $title | |
string[] | $entries |
Reimplemented in SpamBlacklist.
Definition at line 449 of file BaseBlacklist.php.
|
staticprivate |
Array containing blacklists that extend BaseBlacklist.
Definition at line 43 of file BaseBlacklist.php.
Referenced by getBlacklistTypes().
int BaseBlacklist::$expiryTime = 900 |
Definition at line 36 of file BaseBlacklist.php.
array BaseBlacklist::$files = [] |
Array of blacklist sources.
Definition at line 12 of file BaseBlacklist.php.
Referenced by isLocalSource().
|
staticprivate |
Array of blacklist instances.
Definition at line 53 of file BaseBlacklist.php.
|
protected |
Array containing regexes to test against.
Definition at line 19 of file BaseBlacklist.php.
Referenced by buildSharedBlacklists(), getBlacklists(), and getSharedBlacklists().
int BaseBlacklist::$warningChance = 100 |
Chance of receiving a warning when the filter is hit.
Definition at line 26 of file BaseBlacklist.php.
int BaseBlacklist::$warningTime = 600 |
Definition at line 31 of file BaseBlacklist.php.