X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialEditWatchlist.php;h=dd440b96899aafa46c0fc7264d5f6221ea2899ec;hb=659fd5ec9cecbb7f3774107a28a26b2b244de4a1;hp=e76988dd7dcc43fcecde545f6f604e77862f33ab;hpb=8e5ec3f6cf9cb5f3ecf5ff30430ff37b5a7857a7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index e76988dd7d..dd440b9689 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -307,32 +307,25 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { private function getWatchlist() { $list = []; - $index = $this->getRequest()->wasPosted() ? DB_MASTER : DB_SLAVE; - $dbr = wfGetDB( $index ); - - $res = $dbr->select( - 'watchlist', - [ - 'wl_namespace', 'wl_title' - ], [ - 'wl_user' => $this->getUser()->getId(), - ], - __METHOD__ + $watchedItems = WatchedItemStore::getDefaultInstance()->getWatchedItemsForUser( + $this->getUser(), + [ 'forWrite' => $this->getRequest()->wasPosted() ] ); - if ( $res->numRows() > 0 ) { + if ( $watchedItems ) { /** @var Title[] $titles */ $titles = []; - foreach ( $res as $row ) { - $title = Title::makeTitleSafe( $row->wl_namespace, $row->wl_title ); + foreach ( $watchedItems as $watchedItem ) { + $namespace = $watchedItem->getLinkTarget()->getNamespace(); + $dbKey = $watchedItem->getLinkTarget()->getDBkey(); + $title = Title::makeTitleSafe( $namespace, $dbKey ); - if ( $this->checkTitle( $title, $row->wl_namespace, $row->wl_title ) + if ( $this->checkTitle( $title, $namespace, $dbKey ) && !$title->isTalkPage() ) { $titles[] = $title; } } - $res->free(); GenderCache::singleton()->doTitlesArray( $titles );