* @file
*/
+use MediaWiki\MediaWikiServices;
use MediaWiki\Session\SessionManager;
use MediaWiki\Session\Token;
*/
protected static function getInProcessCache() {
if ( !self::$inProcessCache ) {
- self::$inProcessCache = new HashBagOStuff( ['maxKeys' => 10] );
+ self::$inProcessCache = new HashBagOStuff( [ 'maxKeys' => 10 ] );
}
return self::$inProcessCache;
}
foreach ( LanguageConverter::$languagesWithVariants as $langCode ) {
$defOpt[$langCode == $wgContLang->getCode() ? 'variant' : "variant-$langCode"] = $langCode;
}
- foreach ( SearchEngine::searchableNamespaces() as $nsnum => $nsname ) {
+ $namespaces = MediaWikiServices::getInstance()->getSearchEngineConfig()->searchableNamespaces();
+ foreach ( $namespaces as $nsnum => $nsname ) {
$defOpt['searchNs' . $nsnum] = !empty( $wgNamespacesToBeSearchedDefault[$nsnum] );
}
$defOpt['skin'] = Skin::normalizeKey( $wgDefaultSkin );
*/
public function isWatched( $title, $checkRights = self::CHECK_USER_RIGHTS ) {
if ( $title->isWatchable() && ( !$checkRights || $this->isAllowed( 'viewmywatchlist' ) ) ) {
- return WatchedItemStore::getDefaultInstance()->isWatched( $this, $title );
+ return MediaWikiServices::getInstance()->getWatchedItemStore()->isWatched( $this, $title );
}
return false;
}
*/
public function addWatch( $title, $checkRights = self::CHECK_USER_RIGHTS ) {
if ( !$checkRights || $this->isAllowed( 'editmywatchlist' ) ) {
- WatchedItemStore::getDefaultInstance()->addWatchBatchForUser(
+ MediaWikiServices::getInstance()->getWatchedItemStore()->addWatchBatchForUser(
$this,
[ $title->getSubjectPage(), $title->getTalkPage() ]
);
*/
public function removeWatch( $title, $checkRights = self::CHECK_USER_RIGHTS ) {
if ( !$checkRights || $this->isAllowed( 'editmywatchlist' ) ) {
- WatchedItemStore::getDefaultInstance()->removeWatch( $this, $title->getSubjectPage() );
- WatchedItemStore::getDefaultInstance()->removeWatch( $this, $title->getTalkPage() );
+ $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+ $store->removeWatch( $this, $title->getSubjectPage() );
+ $store->removeWatch( $this, $title->getTalkPage() );
}
$this->invalidateCache();
}
$force = 'force';
}
- WatchedItemStore::getDefaultInstance()
+ MediaWikiServices::getInstance()->getWatchedItemStore()
->resetNotificationTimestamp( $this, $title, $force, $oldid );
}