* @param User $user
* @param LinkTarget $target
*
- * @return WatchedItem|null
+ * @return WatchedItem|false
*/
private function getCached( User $user, LinkTarget $target ) {
return $this->cache->get( $this->getCacheKey( $user, $target ) );
$watchedItems = [];
foreach ( $res as $row ) {
- // todo these could all be cached at some point?
+ // @todo: Should we add these to the process cache?
$watchedItems[] = new WatchedItem(
$user,
new TitleValue( (int)$row->wl_namespace, $row->wl_title ),
}
$rows = [];
+ $items = [];
foreach ( $targets as $target ) {
$rows[] = [
'wl_user' => $user->getId(),
'wl_title' => $target->getDBkey(),
'wl_notificationtimestamp' => null,
];
+ $items[] = new WatchedItem(
+ $user,
+ $target,
+ null
+ );
$this->uncache( $user, $target );
}
// if there's already an entry for this page
$dbw->insert( 'watchlist', $toInsert, __METHOD__, 'IGNORE' );
}
+ // Update process cache to ensure skin doesn't claim that the current
+ // page is unwatched in the response of action=watch itself (T28292).
+ // This would otherwise be re-queried from a slave by isWatched().
+ foreach ( $items as $item ) {
+ $this->cache( $item );
+ }
return true;
}