From a67c0252e315d2f46f2fc147f5a3804bb119b2e2 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 4 Aug 2017 16:42:46 -0700 Subject: [PATCH] SpecialWatchlist: Always apply a LIMIT In non-extended mode, the query that SpecialWatchlist ran was unlimited, which is a very bad idea, since some users have tens of thousands of pages on their watchlist. There are broader performance issues with large watchlists, but this doesn't help. With this patch the wllimit preference is used to limit the number of results both in expanded and in non-expanded mode. Bug: T171027 Change-Id: Ifcefe6f77fa4adeca2e50714813004018819aee8 --- includes/specials/SpecialWatchlist.php | 10 ++++------ languages/i18n/en.json | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 549362f20f..9e01d2d450 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -277,7 +277,6 @@ class SpecialWatchlist extends ChangesListSpecialPage { # Toggle watchlist content (all recent edits or just the latest) if ( $opts['extended'] ) { - $limitWatchlist = $user->getIntOption( 'wllimit' ); $usePage = false; } else { # Top log Ids for a page are not stored @@ -292,14 +291,16 @@ class SpecialWatchlist extends ChangesListSpecialPage { LIST_OR ); } - $limitWatchlist = 0; $usePage = true; } $tables = array_merge( [ 'recentchanges', 'watchlist' ], $tables ); $fields = array_merge( RecentChange::selectFields(), $fields ); - $query_options = array_merge( [ 'ORDER BY' => 'rc_timestamp DESC' ], $query_options ); + $query_options = array_merge( [ + 'ORDER BY' => 'rc_timestamp DESC', + 'LIMIT' => $user->getIntOption( 'wllimit' ) + ], $query_options ); $join_conds = array_merge( [ 'watchlist' => [ @@ -317,9 +318,6 @@ class SpecialWatchlist extends ChangesListSpecialPage { if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) { $fields[] = 'wl_notificationtimestamp'; } - if ( $limitWatchlist ) { - $query_options['LIMIT'] = $limitWatchlist; - } $rollbacker = $user->isAllowed( 'rollback' ); if ( $usePage || $rollbacker ) { diff --git a/languages/i18n/en.json b/languages/i18n/en.json index aa1254cff0..a14e926754 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1021,7 +1021,7 @@ "prefs-editwatchlist-clear": "Clear your watchlist", "prefs-watchlist-days": "Days to show in watchlist:", "prefs-watchlist-days-max": "Maximum $1 {{PLURAL:$1|day|days}}", - "prefs-watchlist-edits": "Maximum number of changes to show in expanded watchlist:", + "prefs-watchlist-edits": "Maximum number of changes to show in watchlist:", "prefs-watchlist-edits-max": "Maximum number: 1000", "prefs-watchlist-token": "Watchlist token:", "prefs-misc": "Misc", -- 2.20.1