X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fspecials%2FSpecialEditWatchlist.php;h=e1ecfe8cd516731cbe6a2f83e7736c62dcb36f29;hb=b1dfb00704a39474a7b69ecf464227502c7aa57c;hp=a5a45d5927cb8e8a779ab70d0d748b0c4f50af5b;hpb=99dbf4e1d4d7f18e02935bdb8cd3be4413ffe729;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index a5a45d5927..e1ecfe8cd5 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -68,8 +68,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { */ private function initServices() { if ( !$this->titleParser ) { - $lang = $this->getContext()->getLanguage(); - $this->titleParser = new MediaWikiTitleCodec( $lang, GenderCache::singleton() ); + $this->titleParser = MediaWikiServices::getInstance()->getTitleParser(); } } @@ -150,7 +149,6 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { /** * Executes an edit mode for the watchlist view, from which you can manage your watchlist - * */ protected function executeViewEditWatchlist() { $out = $this->getOutput(); @@ -205,7 +203,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { } } - GenderCache::singleton()->doTitlesArray( $titles ); + MediaWikiServices::getInstance()->getGenderCache()->doTitlesArray( $titles ); $list = []; /** @var Title $title */ @@ -355,7 +353,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { } } - GenderCache::singleton()->doTitlesArray( $titles ); + MediaWikiServices::getInstance()->getGenderCache()->doTitlesArray( $titles ); foreach ( $titles as $title ) { $list[] = $title->getPrefixedText(); @@ -431,20 +429,22 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { } $user = $this->getUser(); - $store = MediaWikiServices::getInstance()->getWatchedItemStore(); - - foreach ( $this->badItems as $row ) { - list( $title, $namespace, $dbKey ) = $row; - $action = $title ? 'cleaning up' : 'deleting'; - wfDebug( "User {$user->getName()} has broken watchlist item ns($namespace):$dbKey, $action.\n" ); - - $store->removeWatch( $user, new TitleValue( (int)$namespace, $dbKey ) ); - - // Can't just do an UPDATE instead of DELETE/INSERT due to unique index - if ( $title ) { - $user->addWatch( $title ); + $badItems = $this->badItems; + DeferredUpdates::addCallableUpdate( function () use ( $user, $badItems ) { + $store = MediaWikiServices::getInstance()->getWatchedItemStore(); + foreach ( $badItems as $row ) { + list( $title, $namespace, $dbKey ) = $row; + $action = $title ? 'cleaning up' : 'deleting'; + wfDebug( "User {$user->getName()} has broken watchlist item " . + "ns($namespace):$dbKey, $action.\n" ); + + $store->removeWatch( $user, new TitleValue( (int)$namespace, $dbKey ) ); + // Can't just do an UPDATE instead of DELETE/INSERT due to unique index + if ( $title ) { + $user->addWatch( $title ); + } } - } + } ); } /** @@ -629,7 +629,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { if ( $title->exists() ) { $tools['history'] = $linkRenderer->makeKnownLink( $title, - $this->msg( 'history_short' )->text(), + $this->msg( 'history_small' )->text(), [], [ 'action' => 'history' ] ); @@ -793,7 +793,7 @@ class EditWatchlistCheckboxSeriesField extends HTMLMultiSelectField { * HTMLMultiSelectField throws validation errors if we get input data * that doesn't match the data set in the form setup. This causes * problems if something gets removed from the watchlist while the - * form is open (bug 32126), but we know that invalid items will + * form is open (T34126), but we know that invalid items will * be harmless so we can override it here. * * @param string $value The value the field was submitted with