From: Aaron Schulz Date: Wed, 26 Aug 2015 23:54:23 +0000 (-0700) Subject: Avoid using DB_MASTER in SpecialEditWatchlist::getWatchlist() X-Git-Tag: 1.31.0-rc.0~10253^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=326b78428d5df8c67afb8710338e8a547501ba0f;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );