X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fwatcheditem%2FNoWriteWatchedItemStore.php;h=72f6086dfb18f470a8589ded63cce0e7e7a038e4;hb=761e704d6e59b611241e6c83ea37dca3ab90e9e0;hp=f4e3af2370f08cb117800188e327979e7e2bdfe1;hpb=ac0ab2c03a12756b0965f250c174e228348ec459;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/watcheditem/NoWriteWatchedItemStore.php b/includes/watcheditem/NoWriteWatchedItemStore.php index f4e3af2370..72f6086dfb 100644 --- a/includes/watcheditem/NoWriteWatchedItemStore.php +++ b/includes/watcheditem/NoWriteWatchedItemStore.php @@ -18,7 +18,9 @@ * @file * @ingroup Watchlist */ + use MediaWiki\Linker\LinkTarget; +use MediaWiki\User\UserIdentity; use Wikimedia\Rdbms\DBReadOnlyError; /** @@ -32,6 +34,8 @@ class NoWriteWatchedItemStore implements WatchedItemStoreInterface { */ private $actualStore; + const DB_READONLY_ERROR = 'The watchlist is currently readonly.'; + /** * Initialy set WatchedItemStore that will be used in cases where writing is not needed. * @param WatchedItemStoreInterface $actualStore @@ -40,7 +44,7 @@ class NoWriteWatchedItemStore implements WatchedItemStoreInterface { $this->actualStore = $actualStore; } - public function countWatchedItems( User $user ) { + public function countWatchedItems( UserIdentity $user ) { return $this->actualStore->countWatchedItems( $user ); } @@ -66,85 +70,92 @@ class NoWriteWatchedItemStore implements WatchedItemStoreInterface { ); } - public function getWatchedItem( User $user, LinkTarget $target ) { + public function getWatchedItem( UserIdentity $user, LinkTarget $target ) { return $this->actualStore->getWatchedItem( $user, $target ); } - public function loadWatchedItem( User $user, LinkTarget $target ) { + public function loadWatchedItem( UserIdentity $user, LinkTarget $target ) { return $this->actualStore->loadWatchedItem( $user, $target ); } - public function getWatchedItemsForUser( User $user, array $options = [] ) { + public function getWatchedItemsForUser( UserIdentity $user, array $options = [] ) { return $this->actualStore->getWatchedItemsForUser( $user, $options ); } - public function isWatched( User $user, LinkTarget $target ) { + public function isWatched( UserIdentity $user, LinkTarget $target ) { return $this->actualStore->isWatched( $user, $target ); } - public function getNotificationTimestampsBatch( User $user, array $targets ) { + public function getNotificationTimestampsBatch( UserIdentity $user, array $targets ) { return $this->actualStore->getNotificationTimestampsBatch( $user, $targets ); } - public function countUnreadNotifications( User $user, $unreadLimit = null ) { + public function countUnreadNotifications( UserIdentity $user, $unreadLimit = null ) { return $this->actualStore->countUnreadNotifications( $user, $unreadLimit ); } public function duplicateAllAssociatedEntries( LinkTarget $oldTarget, LinkTarget $newTarget ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } public function duplicateEntry( LinkTarget $oldTarget, LinkTarget $newTarget ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } - public function addWatch( User $user, LinkTarget $target ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + public function addWatch( UserIdentity $user, LinkTarget $target ) { + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } - public function addWatchBatchForUser( User $user, array $targets ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + public function addWatchBatchForUser( UserIdentity $user, array $targets ) { + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } - public function removeWatch( User $user, LinkTarget $target ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + public function removeWatch( UserIdentity $user, LinkTarget $target ) { + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } public function setNotificationTimestampsForUser( - User $user, + UserIdentity $user, $timestamp, array $targets = [] ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } - public function updateNotificationTimestamp( User $editor, LinkTarget $target, $timestamp ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + public function updateNotificationTimestamp( + UserIdentity $editor, LinkTarget $target, $timestamp + ) { + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } - public function resetAllNotificationTimestampsForUser( User $user ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + public function resetAllNotificationTimestampsForUser( UserIdentity $user ) { + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } public function resetNotificationTimestamp( - User $user, - Title $title, + UserIdentity $user, + LinkTarget $title, $force = '', $oldid = 0 ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } - public function clearUserWatchedItems( User $user ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + public function clearUserWatchedItems( UserIdentity $user ) { + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } - public function clearUserWatchedItemsUsingJobQueue( User $user ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + public function clearUserWatchedItemsUsingJobQueue( UserIdentity $user ) { + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } - public function removeWatchBatchForUser( User $user, array $titles ) { - throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' ); + public function removeWatchBatchForUser( UserIdentity $user, array $titles ) { + throw new DBReadOnlyError( null, self::DB_READONLY_ERROR ); } + public function getLatestNotificationTimestamp( + $timestamp, UserIdentity $user, LinkTarget $target + ) { + return wfTimestampOrNull( TS_MW, $timestamp ); + } }