From b0c0fb9459aea8ddbcab2c75f8d41d59ae7c1d3b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 18 Jul 2016 18:43:37 +0200 Subject: [PATCH] ContribsPager: Disallow looking too far in the past for 'newbies' queries If the user requested a timestamp offset far in the past such that there are no edits by users with user_ids in the range, we would end up scanning all revisions from that offset until start of time. This might end up generating funny queries with redundant conditions on rev_timestamp, but that should not be a problem, and trying to tweak paging logic would probably be more difficult than this. Bug: T140537 Change-Id: I2ac9abee09529620588923bbafbcac07ebe466b2 --- includes/specials/pagers/ContribsPager.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php index fe0b4fea4b..f8eba9a985 100644 --- a/includes/specials/pagers/ContribsPager.php +++ b/includes/specials/pagers/ContribsPager.php @@ -224,6 +224,11 @@ class ContribsPager extends ReverseChronologicalPager { ] ]; } + // (T140537) Disallow looking too far in the past for 'newbies' queries. If the user requested + // a timestamp offset far in the past such that there are no edits by users with user_ids in + // the range, we would end up scanning all revisions from that offset until start of time. + $condition[] = 'rev_timestamp > ' . + $this->mDb->addQuotes( $this->mDb->timestamp( wfTimestamp() - 30 * 24 * 60 * 60 ) ); } else { $uid = User::idFromName( $this->target ); if ( $uid ) { -- 2.20.1