Page MenuHomePhabricator

T71367_01_AbuseFilter.patch

Authored By
dpatrick
Oct 13 2015, 9:50 PM
Size
1 KB
Referenced Files
None
Subscribers
None

T71367_01_AbuseFilter.patch

From 50505a773ceadfb2bf41974577e53aea8273fda2 Mon Sep 17 00:00:00 2001
From: Darian Anthony Patrick <dpatrick@wikimedia.org>
Date: Tue, 13 Oct 2015 14:25:00 -0700
Subject: [PATCH] Prevent article_recent_contributors leaking revdeleted user
names
This patch depends on a correspoding patch to core, which has been
attached to the bug listed below.
Bug: T71367
Change-Id: I68d38aaed495016ff2fd0c05bee348fc5477ab23
---
AbuseFilterVariableHolder.php | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/AbuseFilterVariableHolder.php b/AbuseFilterVariableHolder.php
index 1cb1888..0ef16e1 100644
--- a/AbuseFilterVariableHolder.php
+++ b/AbuseFilterVariableHolder.php
@@ -502,27 +502,30 @@ class AFComputedVariable {
}
$dbr = wfGetDB( DB_SLAVE );
- $sqlTmp = $dbr->selectSQLText(
+ $limit = 100;
+ $res = $dbr->select(
'revision',
- array( 'rev_user_text', 'rev_timestamp' ),
+ array( 'rev_id' ),
array(
'rev_page' => $title->getArticleID(),
'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $cutOff ) )
),
__METHOD__,
// Some pages have < 10 authors but many revisions (e.g. bot pages)
- array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 100 )
+ array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => $limit )
);
- $res = $dbr->query(
- "SELECT rev_user_text FROM ($sqlTmp) AS tmp " .
- "GROUP BY rev_user_text ORDER BY MAX(rev_timestamp) DESC LIMIT 10",
- __METHOD__
+
+ $from = $res->fetchRow();
+ $res->seek($res->numRows());
+ $to = $res->fetchRow();
+
+ $users = $title->getAuthorsBetween(
+ $from['rev_id'],
+ $to['rev_id'],
+ $limit,
+ array( 'include_both' => true, 'visibility' => 'FOR_PUBLIC' )
);
- $users = array();
- foreach( $res as $row ) {
- $users[] = $row->rev_user_text;
- }
$result = $users;
break;
case 'load-first-author':
--
2.3.8 (Apple Git-58)

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2730190
Default Alt Text
T71367_01_AbuseFilter.patch (1 KB)

Event Timeline