From 326b78428d5df8c67afb8710338e8a547501ba0f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 26 Aug 2015 16:54:23 -0700 Subject: [PATCH] Avoid using DB_MASTER in SpecialEditWatchlist::getWatchlist() * Only use it on POST requests, where the submit callback really wants the latest data. The form data will be lagged by user delay anyway, so using the slave there does not change much. ChronologyProtector already handles the user seeing their *own* changes for consecutive updates. Bug: T92357 Change-Id: I50274ad5f67f6445a89c9d8d6f01d3fca1e9002b --- includes/specials/SpecialEditWatchlist.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index 3d688138af..74662aec8e 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -299,7 +299,9 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { */ private function getWatchlist() { $list = array(); - $dbr = wfGetDB( DB_MASTER ); + + $index = $this->getRequest()->wasPosted() ? DB_MASTER : DB_SLAVE; + $dbr = wfGetDB( $index ); $res = $dbr->select( 'watchlist', @@ -312,6 +314,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { ); if ( $res->numRows() > 0 ) { + /** @var Title[] $titles */ $titles = array(); foreach ( $res as $row ) { $title = Title::makeTitleSafe( $row->wl_namespace, $row->wl_title ); -- 2.20.1