And now SpamBlacklist checks the edit summary field.

This commit is contained in:
Chad Horohoe 2008-06-19 03:14:34 +00:00
parent ef1bbc37dc
commit 0909094e01
2 changed files with 9 additions and 5 deletions

View file

@ -72,18 +72,18 @@ function wfSpamBlacklistObject() {
/**
* Hook function for $wgFilterCallback
*/
function wfSpamBlacklistFilter( &$title, $text, $section ) {
function wfSpamBlacklistFilter( &$title, $text, $section, &$hookErr, $editSummary ) {
$spamObj = wfSpamBlacklistObject();
return $spamObj->filter( $title, $text, $section );
return $spamObj->filter( $title, $text, $section, $editSummary );
}
/**
* Hook function for EditFilterMerged, replaces wfSpamBlacklistFilter
*/
function wfSpamBlacklistFilterMerged( $editPage, $text ) {
function wfSpamBlacklistFilterMerged( $editPage, $text, &$hookErr, $editSummary ) {
$spamObj = wfSpamBlacklistObject();
$title = $editPage->mArticle->getTitle();
$ret = $spamObj->filter( $title, $text, '', $editPage );
$ret = $spamObj->filter( $title, $text, '', $editPage, $editSummary );
// Return convention for hooks is the inverse of $wgFilterCallback
return !$ret;
}

View file

@ -185,10 +185,11 @@ class SpamBlacklist {
* @param string $text Text of section, or entire text if $editPage!=false
* @param string $section Section number or name
* @param EditPage $editPage EditPage if EditFilterMerged was called, false otherwise
* @param EditSummary $editSummary Edit summary if one exists, some people use urls there too
* @return True if the edit should not be allowed, false otherwise
* If the return value is true, an error will have been sent to $wgOut
*/
function filter( &$title, $text, $section, $editPage = false ) {
function filter( &$title, $text, $section, $editPage = false, $editsummary = '' ) {
global $wgArticle, $wgVersion, $wgOut, $wgParser, $wgUser;
$fname = 'wfSpamBlacklistFilter';
@ -226,6 +227,9 @@ class SpamBlacklist {
$oldLinks = $this->getCurrentLinks( $title );
$addedLinks = array_diff( $newLinks, $oldLinks );
// We add the edit summary if one exists
if ( !empty( $editsummary ) ) $addedLinks[] = $editsummary;
wfDebugLog( 'SpamBlacklist', "Old URLs: " . implode( ', ', $oldLinks ) );
wfDebugLog( 'SpamBlacklist', "New URLs: " . implode( ', ', $newLinks ) );
wfDebugLog( 'SpamBlacklist', "Added URLs: " . implode( ', ', $addedLinks ) );