mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SpamBlacklist
synced 2024-11-12 01:01:57 +00:00
Categorize pages containing blacklisted links
Add pages containing links that match the spam blacklist to a tracking category. Change-Id: I694860bc77d05dccd81522efc23225481d51ee43
This commit is contained in:
parent
d32162da19
commit
32b546a223
|
@ -52,6 +52,8 @@ $messages['en'] = array(
|
|||
'spam-blacklisted-email-text' => 'Your email address is currently blacklisted from sending emails to other users.',
|
||||
'spam-blacklisted-email-signup' => 'The given email address is currently blacklisted from use.',
|
||||
|
||||
'spam-blacklisted-category' => 'Pages containing blacklisted links',
|
||||
|
||||
'spam-invalid-lines' => "The following spam blacklist {{PLURAL:$1|line is an|lines are}} invalid regular {{PLURAL:$1|expression|expressions}} and {{PLURAL:$1|needs|need}} to be corrected before saving the page:",
|
||||
'spam-blacklist-desc' => 'Regex-based anti-spam tool allowing to blacklist URLs in pages and email addresses for registered users',
|
||||
'log-name-spamblacklist' => 'Spam blacklist log',
|
||||
|
@ -77,6 +79,7 @@ $messages['qqq'] = array(
|
|||
'spam-blacklisted-email' => 'Title of errorpage when trying to send an email with a blacklisted e-mail address',
|
||||
'spam-blacklisted-email-text' => 'Text of errorpage when trying to send an e-mail with a blacklisted e-mail address',
|
||||
'spam-blacklisted-email-signup' => 'Error when trying to create an account with an invalid e-mail address',
|
||||
'spam-blacklisted-category' => 'The category to place pages containing blacklisted links into',
|
||||
'spam-invalid-lines' => 'Used as an error message.
|
||||
|
||||
This message is followed by a list of bad lines.
|
||||
|
|
|
@ -58,6 +58,9 @@ $wgHooks['APIEditBeforeSave'][] = 'SpamBlacklistHooks::filterAPIEditBeforeSave';
|
|||
$wgHooks['EditFilter'][] = 'SpamBlacklistHooks::validate';
|
||||
$wgHooks['PageContentSaveComplete'][] = 'SpamBlacklistHooks::pageSaveContent';
|
||||
|
||||
// categorize pages containing blacklisted links
|
||||
$wgHooks['ParserAfterParse'][] = 'SpamBlacklistHooks::parserAfterParse';
|
||||
|
||||
// email filters
|
||||
$wgHooks['UserCanSendEmail'][] = 'SpamBlacklistHooks::userCanSendEmail';
|
||||
$wgHooks['AbortNewAccount'][] = 'SpamBlacklistHooks::abortNewAccount';
|
||||
|
|
|
@ -219,4 +219,12 @@ class SpamBlacklistHooks {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static function parserAfterParse( $parser, $text, $stripState ) {
|
||||
$links = $parser->getOutput()->getExternalLinks();
|
||||
if ( $links && BaseBlacklist::getInstance( 'spam' )->filter( array_keys( $links ), null, true ) ) {
|
||||
$parser->addTrackingCategory( 'spam-blacklisted-category' );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,11 +92,11 @@ class SpamBlacklist extends BaseBlacklist {
|
|||
wfRestoreWarnings();
|
||||
if( $check ) {
|
||||
wfDebugLog( 'SpamBlacklist', "Match!\n" );
|
||||
global $wgRequest;
|
||||
$ip = $wgRequest->getIP();
|
||||
$imploded = implode( ' ', $matches[0] );
|
||||
wfDebugLog( 'SpamBlacklistHit', "$ip caught submitting spam: $imploded\n" );
|
||||
if( !$preventLog ) {
|
||||
global $wgRequest;
|
||||
$ip = $wgRequest->getIP();
|
||||
$imploded = implode( ' ', $matches[0] );
|
||||
wfDebugLog( 'SpamBlacklistHit', "$ip caught submitting spam: $imploded\n" );
|
||||
$this->logFilterHit( $title, $imploded ); // Log it
|
||||
}
|
||||
if( $retVal === false ){
|
||||
|
|
Loading…
Reference in a new issue