From: Alex Monk Date: Thu, 16 Jul 2015 20:42:53 +0000 (-0500) Subject: InfoAction: Use watchlist query group for watchlist queries X-Git-Tag: 1.31.0-rc.0~10743^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=a2e0bf21864912f22350fc0bb5d67e896f53b6e6;p=lhc%2Fweb%2Fwiklou.git InfoAction: Use watchlist query group for watchlist queries Bug: T105852 Change-Id: I8fd38caf04e60f34f76077cd66e447f09fa2f487 --- diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 0c1a344864..5491f817b4 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -675,11 +675,11 @@ class InfoAction extends FormlessAction { $id = $title->getArticleID(); $config = $this->context->getConfig(); - $dbr = wfGetDB( DB_SLAVE ); + $dbrWatchlist = wfGetDB( DB_SLAVE, 'watchlist' ); $result = array(); // Number of page watchers - $watchers = (int)$dbr->selectField( + $watchers = (int)$dbrWatchlist->selectField( 'watchlist', 'COUNT(*)', array( @@ -694,15 +694,15 @@ class InfoAction extends FormlessAction { // Threshold: last visited about 26 weeks before latest edit $updated = wfTimestamp( TS_UNIX, $this->page->getTimestamp() ); $age = $config->get( 'WatchersMaxAge' ); - $threshold = $dbr->timestamp( $updated - $age ); + $threshold = $dbrWatchlist->timestamp( $updated - $age ); // Number of page watchers who also visited a "recent" edit - $visitingWatchers = (int)$dbr->selectField( + $visitingWatchers = (int)$dbrWatchlist->selectField( 'watchlist', 'COUNT(*)', array( 'wl_namespace' => $title->getNamespace(), 'wl_title' => $title->getDBkey(), - 'wl_notificationtimestamp >= ' . $dbr->addQuotes( $threshold ) . + 'wl_notificationtimestamp >= ' . $dbrWatchlist->addQuotes( $threshold ) . ' OR wl_notificationtimestamp IS NULL' ), __METHOD__ @@ -710,6 +710,7 @@ class InfoAction extends FormlessAction { $result['visitingWatchers'] = $visitingWatchers; } + $dbr = wfGetDB( DB_SLAVE ); // Total number of edits $edits = (int)$dbr->selectField( 'revision',