$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(
// 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__
$result['visitingWatchers'] = $visitingWatchers;
}
+ $dbr = wfGetDB( DB_SLAVE );
// Total number of edits
$edits = (int)$dbr->selectField(
'revision',