3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
21 use MediaWiki\Linker\LinkTarget
;
22 use Wikimedia\Rdbms\DBReadOnlyError
;
28 class NoWriteWatchedItemStore
implements WatchedItemStoreInterface
{
31 * @var WatchedItemStoreInterface
36 * Initialy set WatchedItemStore that will be used in cases where writing is not needed.
37 * @param WatchedItemStoreInterface $actualStore
39 public function __construct( WatchedItemStoreInterface
$actualStore ) {
40 $this->actualStore
= $actualStore;
43 public function countWatchedItems( User
$user ) {
44 return $this->actualStore
->countWatchedItems( $user );
47 public function countWatchers( LinkTarget
$target ) {
48 return $this->actualStore
->countWatchers( $target );
51 public function countVisitingWatchers( LinkTarget
$target, $threshold ) {
52 return $this->actualStore
->countVisitingWatchers( $target, $threshold );
55 public function countWatchersMultiple( array $targets, array $options = [] ) {
56 return $this->actualStore
->countVisitingWatchersMultiple( $targets, $options );
59 public function countVisitingWatchersMultiple(
60 array $targetsWithVisitThresholds,
61 $minimumWatchers = null
63 return $this->actualStore
->countVisitingWatchersMultiple(
64 $targetsWithVisitThresholds,
69 public function getWatchedItem( User
$user, LinkTarget
$target ) {
70 return $this->actualStore
->getWatchedItem( $user, $target );
73 public function loadWatchedItem( User
$user, LinkTarget
$target ) {
74 return $this->actualStore
->loadWatchedItem( $user, $target );
77 public function getWatchedItemsForUser( User
$user, array $options = [] ) {
78 return $this->actualStore
->getWatchedItemsForUser( $user, $options );
81 public function isWatched( User
$user, LinkTarget
$target ) {
82 return $this->actualStore
->isWatched( $user, $target );
85 public function getNotificationTimestampsBatch( User
$user, array $targets ) {
86 return $this->actualStore
->getNotificationTimestampsBatch( $user, $targets );
89 public function countUnreadNotifications( User
$user, $unreadLimit = null ) {
90 return $this->actualStore
->countUnreadNotifications( $user, $unreadLimit );
93 public function duplicateAllAssociatedEntries( LinkTarget
$oldTarget, LinkTarget
$newTarget ) {
94 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
97 public function duplicateEntry( LinkTarget
$oldTarget, LinkTarget
$newTarget ) {
98 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
101 public function addWatch( User
$user, LinkTarget
$target ) {
102 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
105 public function addWatchBatchForUser( User
$user, array $targets ) {
106 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
109 public function removeWatch( User
$user, LinkTarget
$target ) {
110 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
113 public function setNotificationTimestampsForUser(
118 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
121 public function updateNotificationTimestamp( User
$editor, LinkTarget
$target, $timestamp ) {
122 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
125 public function resetAllNotificationTimestampsForUser( User
$user ) {
126 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
129 public function resetNotificationTimestamp(
135 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
138 public function clearUserWatchedItems( User
$user ) {
139 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
142 public function clearUserWatchedItemsUsingJobQueue( User
$user ) {
143 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );