summaryrefslogtreecommitdiff
path: root/www/wiki/includes/watcheditem/NoWriteWatchedItemStore.php
blob: 86e7be855ef085e4f04b119cc50c442429f3018f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @ingroup Watchlist
 */
use MediaWiki\Linker\LinkTarget;
use Wikimedia\Rdbms\DBReadOnlyError;

/**
 * @internal
 * @since 1.31
 */
class NoWriteWatchedItemStore implements WatchedItemStoreInterface {

	/**
	 * @var WatchedItemStoreInterface
	 */
	private $actualStore;

	/**
	 * Initialy set WatchedItemStore that will be used in cases where writing is not needed.
	 * @param WatchedItemStoreInterface $actualStore
	 */
	public function __construct( WatchedItemStoreInterface $actualStore ) {
		$this->actualStore = $actualStore;
	}

	public function countWatchedItems( User $user ) {
		return $this->actualStore->countWatchedItems( $user );
	}

	public function countWatchers( LinkTarget $target ) {
		return $this->actualStore->countWatchers( $target );
	}

	public function countVisitingWatchers( LinkTarget $target, $threshold ) {
		return $this->actualStore->countVisitingWatchers( $target, $threshold );
	}

	public function countWatchersMultiple( array $targets, array $options = [] ) {
		return $this->actualStore->countVisitingWatchersMultiple( $targets, $options );
	}

	public function countVisitingWatchersMultiple(
		array $targetsWithVisitThresholds,
		$minimumWatchers = null
	) {
		return $this->actualStore->countVisitingWatchersMultiple(
			$targetsWithVisitThresholds,
			$minimumWatchers
		);
	}

	public function getWatchedItem( User $user, LinkTarget $target ) {
		return $this->actualStore->getWatchedItem( $user, $target );
	}

	public function loadWatchedItem( User $user, LinkTarget $target ) {
		return $this->actualStore->loadWatchedItem( $user, $target );
	}

	public function getWatchedItemsForUser( User $user, array $options = [] ) {
		return $this->actualStore->getWatchedItemsForUser( $user, $options );
	}

	public function isWatched( User $user, LinkTarget $target ) {
		return $this->actualStore->isWatched( $user, $target );
	}

	public function getNotificationTimestampsBatch( User $user, array $targets ) {
		return $this->actualStore->getNotificationTimestampsBatch( $user, $targets );
	}

	public function countUnreadNotifications( User $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.' );
	}

	public function duplicateEntry( LinkTarget $oldTarget, LinkTarget $newTarget ) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function addWatch( User $user, LinkTarget $target ) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function addWatchBatchForUser( User $user, array $targets ) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function removeWatch( User $user, LinkTarget $target ) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function setNotificationTimestampsForUser(
		User $user,
		$timestamp,
		array $targets = []
	) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function updateNotificationTimestamp( User $editor, LinkTarget $target, $timestamp ) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function resetAllNotificationTimestampsForUser( User $user ) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function resetNotificationTimestamp(
		User $user,
		Title $title,
		$force = '',
		$oldid = 0
	) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function clearUserWatchedItems( User $user ) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}

	public function clearUserWatchedItemsUsingJobQueue( User $user ) {
		throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
	}
}