* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A special page that lists last changes made to the wiki,
* limited to user-defined list of titles.
* @return IDatabase
*/
protected function getDB() {
- return wfGetDB( DB_SLAVE, 'watchlist' );
+ return wfGetDB( DB_REPLICA, 'watchlist' );
}
/**
$user = $this->getUser();
$output = $this->getOutput();
- # Show a message about slave lag, if applicable
+ # Show a message about replica DB lag, if applicable
$lag = wfGetLB()->safeGetLag( $dbr );
if ( $lag > 0 ) {
$output->showLagWarning( $lag );
if ( $this->getConfig()->get( 'RCShowWatchingUsers' )
&& $user->getOption( 'shownumberswatching' )
) {
- $watchedItemStore = WatchedItemStore::getDefaultInstance();
+ $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
}
$s = $list->beginRecentChangesList();
+ $userShowHiddenCats = $this->getUser()->getBoolOption( 'showhiddencats' );
$counter = 1;
foreach ( $rows as $obj ) {
# Make RC entry
$rc = RecentChange::newFromRow( $obj );
+
+ # Skip CatWatch entries for hidden cats based on user preference
+ if (
+ $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE &&
+ !$userShowHiddenCats &&
+ $rc->getParam( 'hidden-cat' )
+ ) {
+ continue;
+ }
+
$rc->counter = $counter++;
if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) {
$out->addSubtitle(
$this->msg( 'watchlistfor2', $user->getName() )
- ->rawParams( SpecialEditWatchlist::buildTools( null ) )
+ ->rawParams( SpecialEditWatchlist::buildTools(
+ $this->getLanguage(),
+ $this->getLinkRenderer()
+ ) )
);
$this->setTopText( $opts );
$form .= Xml::openElement( 'form', [
'method' => 'get',
- 'action' => $this->getPageTitle()->getLocalURL(),
+ 'action' => wfScript(),
'id' => 'mw-watchlist-form'
] );
+ $form .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
$form .= Xml::fieldset(
$this->msg( 'watchlist-options' )->text(),
false,
* @return int
*/
protected function countItems() {
- $count = WatchedItemStore::getDefaultInstance()->countWatchedItems( $this->getUser() );
+ $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+ $count = $store->countWatchedItems( $this->getUser() );
return floor( $count / 2 );
}
}