MediaWiki
1.34.0
|
Base class for different kinds of blacklists. More...
Public Member Functions | |
__construct ( $settings=[]) | |
Constructor. More... | |
clearCache () | |
Clear all primary blacklist cache keys. More... | |
filter (array $links, Title $title, $preventLog=false) | |
getBlacklists () | |
Fetch local and (possibly cached) remote blacklists. More... | |
getLocalBlacklists () | |
Returns the local blacklist. More... | |
getRegexEnd ( $batchSize) | |
Returns the end of the regex for matches. More... | |
getRegexStart () | |
Returns the start of the regex for matches. More... | |
getWhitelists () | |
Returns the (local) whitelist. More... | |
warmCachesForFilter (Title $title, array $entries) | |
Static Public Member Functions | |
static | addBlacklistType ( $type, $class) |
Adds a blacklist class to the registry. More... | |
static | getBlacklistTypes () |
Return the array of blacklist types currently defined. More... | |
static | getEmailBlacklist () |
static | getInstance ( $type) |
Returns an instance of the given blacklist. More... | |
static | getSpamBlacklist () |
static | getTypeFromTitle (Title $title) |
Returns the type of blacklist from the given title. More... | |
static | isLocalSource (Title $title) |
Check if the given local page title is a spam regex source. More... | |
Public Attributes | |
int | $expiryTime = 900 |
array | $files = [] |
Array of blacklist sources. More... | |
int | $warningChance = 100 |
Chance of receiving a warning when the filter is hit. More... | |
int | $warningTime = 600 |
Protected Member Functions | |
getBlacklistType () | |
Returns the code for the blacklist implementation. More... | |
Protected Attributes | |
bool array | $regexes = false |
Array containing regexes to test against. More... | |
Private Member Functions | |
buildSharedBlacklists () | |
getArticleText ( $wiki, $pagename) | |
Fetch an article from this or another local MediaWiki database. More... | |
getHttpText ( $fileName) | |
getSharedBlacklists () | |
Fetch (possibly cached) remote blacklists. More... | |
Static Private Attributes | |
static array | $blacklistTypes |
Array containing blacklists that extend BaseBlacklist. More... | |
static array | $instances = [] |
Array of blacklist instances. More... | |
Base class for different kinds of blacklists.
Definition at line 9 of file BaseBlacklist.php.
BaseBlacklist::__construct | ( | $settings = [] | ) |
|
static |
Adds a blacklist class to the registry.
string | $type | |
string | $class |
Definition at line 83 of file BaseBlacklist.php.
References $type.
|
private |
Definition at line 322 of file BaseBlacklist.php.
References $matches, $regexes, getArticleText(), getBlacklistType(), getHttpText(), SpamRegexBatch\regexesFromText(), and wfDebugLog().
BaseBlacklist::clearCache | ( | ) |
Clear all primary blacklist cache keys.
Definition at line 311 of file BaseBlacklist.php.
References $cache, getBlacklistType(), and wfDebugLog().
|
abstract |
|
private |
Fetch an article from this or another local MediaWiki database.
string | $wiki | |
string | $pagename |
Definition at line 389 of file BaseBlacklist.php.
References $content, $title, and wfDebugLog().
Referenced by buildSharedBlacklists().
BaseBlacklist::getBlacklists | ( | ) |
Fetch local and (possibly cached) remote blacklists.
Will be cached locally across multiple invocations.
Definition at line 223 of file BaseBlacklist.php.
References $regexes, 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 92 of file BaseBlacklist.php.
References $blacklistTypes.
Referenced by SpamBlacklistHooks\pageSaveContent().
|
static |
Definition at line 106 of file BaseBlacklist.php.
References getInstance().
Referenced by SpamBlacklistPreAuthenticationProvider\testForAccountCreation(), and SpamBlacklistHooks\userCanSendEmail().
|
private |
Definition at line 352 of file BaseBlacklist.php.
References $messageMemc, $wgDBname, 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 118 of file BaseBlacklist.php.
References $type.
Referenced by ApiSpamBlacklist\execute(), getEmailBlacklist(), getSpamBlacklist(), SpamBlacklistHooks\pageSaveContent(), SpamBlacklistTest\setUp(), and SpamBlacklistHooks\validate().
BaseBlacklist::getLocalBlacklists | ( | ) |
Returns the local blacklist.
Definition at line 238 of file BaseBlacklist.php.
References $cache, $expiryTime, $type, 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 424 of file BaseBlacklist.php.
Referenced by SpamRegexBatch\buildRegexes().
BaseBlacklist::getRegexStart | ( | ) |
Returns the start of the regex for matches.
Reimplemented in SpamBlacklist.
Definition at line 414 of file BaseBlacklist.php.
Referenced by SpamRegexBatch\buildRegexes().
|
private |
Fetch (possibly cached) remote blacklists.
Definition at line 275 of file BaseBlacklist.php.
References $cache, $expiryTime, $regexes, getBlacklistType(), and wfDebugLog().
Referenced by getBlacklists().
|
static |
Definition at line 99 of file BaseBlacklist.php.
References getInstance().
Referenced by Cleanup\execute(), SpamBlacklistHooks\filterMergedContent(), SpamBlacklistHooks\onParserOutputStashForEdit(), and SpamBlacklistHooks\onUploadVerifyUpload().
|
static |
Returns the type of blacklist from the given title.
Title | $title |
Definition at line 205 of file BaseBlacklist.php.
References $title.
Referenced by BaseBlacklistTest\testGetTypeFromTitle(), and SpamBlacklistHooks\validate().
BaseBlacklist::getWhitelists | ( | ) |
Returns the (local) whitelist.
Definition at line 257 of file BaseBlacklist.php.
References $cache, $expiryTime, $type, 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 151 of file BaseBlacklist.php.
References $files, $matches, $title, $type, $wgDBname, NS_MEDIAWIKI, PROTO_HTTP, and wfExpandUrl().
Referenced by SpamBlacklistHooks\pageSaveContent(), and SpamBlacklistHooks\validate().
BaseBlacklist::warmCachesForFilter | ( | Title | $title, |
array | $entries | ||
) |
Title | $title | |
string[] | $entries |
Reimplemented in SpamBlacklist.
Definition at line 432 of file BaseBlacklist.php.
|
staticprivate |
Array containing blacklists that extend BaseBlacklist.
Definition at line 46 of file BaseBlacklist.php.
Referenced by getBlacklistTypes().
int BaseBlacklist::$expiryTime = 900 |
Definition at line 39 of file BaseBlacklist.php.
Referenced by getLocalBlacklists(), getSharedBlacklists(), and getWhitelists().
array BaseBlacklist::$files = [] |
Array of blacklist sources.
Definition at line 15 of file BaseBlacklist.php.
Referenced by isLocalSource().
|
staticprivate |
Array of blacklist instances.
Definition at line 56 of file BaseBlacklist.php.
|
protected |
Array containing regexes to test against.
Definition at line 22 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 29 of file BaseBlacklist.php.
int BaseBlacklist::$warningTime = 600 |
Definition at line 34 of file BaseBlacklist.php.