http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100692
Revision: 100692
Author: hashar
Date: 2011-10-25 12:46:05 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
(bug 31656) AbuseFilter skips non null edits
That bug is triggering when a user submit an old revision unchanged.
The previous Article->getContent() would fetch the old revision which is
then compared to the user submitted text. Since they are identical, filtering
is skipped entirely.
Any editor can then reinstate an old "bad" revision.
Fix:
* Get latest stored revision to compare user submitted text against. This is
done by using: Article->getRevision()->getRawText().
* Move caching related calls after that.
Follow up r52740.
Redo r100687 I had reverted.
Modified Paths:
--------------
trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
Modified: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
===================================================================
--- trunk/extensions/AbuseFilter/AbuseFilter.hooks.php 2011-10-25 12:12:02 UTC
(rev 100691)
+++ trunk/extensions/AbuseFilter/AbuseFilter.hooks.php 2011-10-25 12:46:05 UTC
(rev 100692)
@@ -20,18 +20,19 @@
// Load vars
$vars = new AbuseFilterVariableHolder;
- // Cache article object so we can share a parse operation
- $title = $editor->mTitle;
- $articleCacheKey = $title->getNamespace() . ':' .
$title->getText();
- AFComputedVariable::$articleCache[$articleCacheKey] =
$editor->mArticle;
-
// Check for null edits.
$oldtext = '';
if ( $editor->mArticle->exists() ) {
- $oldtext = $editor->mArticle->getContent();
+ // Make sure we load the latest text saved in database
(bug 31656)
+ $oldtext =
$editor->mArticle->getRevision()->getRawText();
}
+ // Cache article object so we can share a parse operation
+ $title = $editor->mTitle;
+ $articleCacheKey = $title->getNamespace() . ':' .
$title->getText();
+ AFComputedVariable::$articleCache[$articleCacheKey] =
$editor->mArticle;
+
if ( strcmp( $oldtext, $text ) == 0 ) {
// Don't trigger for null edits.
return true;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs