$pages ) { foreach ( array_keys( $pages ) as $dbKey ) { $title = Title::makeTitle( $ns, $dbKey ); // Getting page ID here is safe because SpecialEditWatchlist::getWatchlistInfo() // uses LinkBatch $id = $title->getArticleID(); if ( $id ) { $ids[$id] = $dbKey; } } } $data = PageImages::getImages( array_keys( $ids ) ); foreach ( $data as $id => $page ) { if ( isset( $page['pageimage'] ) ) { $images[ $page['ns'] ][ $ids[$id] ] = $page['pageimage']; } } } }