r100692 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100691‎ | r100692 | r100693 >
Date:12:46, 25 October 2011
Author:hashar
Status:ok
Tags:
Comment:
(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) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
@@ -20,18 +20,19 @@
2121 // Load vars
2222 $vars = new AbuseFilterVariableHolder;
2323
24 - // Cache article object so we can share a parse operation
25 - $title = $editor->mTitle;
26 - $articleCacheKey = $title->getNamespace() . ':' . $title->getText();
27 - AFComputedVariable::$articleCache[$articleCacheKey] = $editor->mArticle;
28 -
2924 // Check for null edits.
3025 $oldtext = '';
3126
3227 if ( $editor->mArticle->exists() ) {
33 - $oldtext = $editor->mArticle->getContent();
 28+ // Make sure we load the latest text saved in database (bug 31656)
 29+ $oldtext = $editor->mArticle->getRevision()->getRawText();
3430 }
3531
 32+ // Cache article object so we can share a parse operation
 33+ $title = $editor->mTitle;
 34+ $articleCacheKey = $title->getNamespace() . ':' . $title->getText();
 35+ AFComputedVariable::$articleCache[$articleCacheKey] = $editor->mArticle;
 36+
3637 if ( strcmp( $oldtext, $text ) == 0 ) {
3738 // Don't trigger for null edits.
3839 return true;

Follow-up revisions

RevisionCommit summaryAuthorDate
r100755REL1_16 MFT r97887, r100573, r100689, r100692reedy22:15, 25 October 2011
r1007601.18wmf1 MFT r100092, r100419, r100686, r100692reedy23:08, 25 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52740Don't trigger AbuseFilter for null edits, bug 19267werdna14:01, 3 July 2009
r100687(bug 31656) AbuseFilter skips non null edits...hashar10:22, 25 October 2011

Status & tagging log