Updated pear/net_smtp from 1.8.0 to 1.8.1
[lhc/web/wiklou.git] / includes / watcheditem / NoWriteWatchedItemStore.php
1 <?php
2 /**
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.
7 *
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.
12 *
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
17 *
18 * @file
19 * @ingroup Watchlist
20 */
21 use MediaWiki\Linker\LinkTarget;
22 use Wikimedia\Rdbms\DBReadOnlyError;
23
24 /**
25 * @internal
26 * @since 1.31
27 */
28 class NoWriteWatchedItemStore implements WatchedItemStoreInterface {
29
30 /**
31 * @var WatchedItemStoreInterface
32 */
33 private $actualStore;
34
35 /**
36 * @var string
37 */
38 const DB_READONLY_ERROR = 'The watchlist is currently readonly.';
39
40 /**
41 * Initialy set WatchedItemStore that will be used in cases where writing is not needed.
42 * @param WatchedItemStoreInterface $actualStore
43 */
44 public function __construct( WatchedItemStoreInterface $actualStore ) {
45 $this->actualStore = $actualStore;
46 }
47
48 public function countWatchedItems( User $user ) {
49 return $this->actualStore->countWatchedItems( $user );
50 }
51
52 public function countWatchers( LinkTarget $target ) {
53 return $this->actualStore->countWatchers( $target );
54 }
55
56 public function countVisitingWatchers( LinkTarget $target, $threshold ) {
57 return $this->actualStore->countVisitingWatchers( $target, $threshold );
58 }
59
60 public function countWatchersMultiple( array $targets, array $options = [] ) {
61 return $this->actualStore->countVisitingWatchersMultiple( $targets, $options );
62 }
63
64 public function countVisitingWatchersMultiple(
65 array $targetsWithVisitThresholds,
66 $minimumWatchers = null
67 ) {
68 return $this->actualStore->countVisitingWatchersMultiple(
69 $targetsWithVisitThresholds,
70 $minimumWatchers
71 );
72 }
73
74 public function getWatchedItem( User $user, LinkTarget $target ) {
75 return $this->actualStore->getWatchedItem( $user, $target );
76 }
77
78 public function loadWatchedItem( User $user, LinkTarget $target ) {
79 return $this->actualStore->loadWatchedItem( $user, $target );
80 }
81
82 public function getWatchedItemsForUser( User $user, array $options = [] ) {
83 return $this->actualStore->getWatchedItemsForUser( $user, $options );
84 }
85
86 public function isWatched( User $user, LinkTarget $target ) {
87 return $this->actualStore->isWatched( $user, $target );
88 }
89
90 public function getNotificationTimestampsBatch( User $user, array $targets ) {
91 return $this->actualStore->getNotificationTimestampsBatch( $user, $targets );
92 }
93
94 public function countUnreadNotifications( User $user, $unreadLimit = null ) {
95 return $this->actualStore->countUnreadNotifications( $user, $unreadLimit );
96 }
97
98 public function duplicateAllAssociatedEntries( LinkTarget $oldTarget, LinkTarget $newTarget ) {
99 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
100 }
101
102 public function duplicateEntry( LinkTarget $oldTarget, LinkTarget $newTarget ) {
103 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
104 }
105
106 public function addWatch( User $user, LinkTarget $target ) {
107 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
108 }
109
110 public function addWatchBatchForUser( User $user, array $targets ) {
111 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
112 }
113
114 public function removeWatch( User $user, LinkTarget $target ) {
115 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
116 }
117
118 public function setNotificationTimestampsForUser(
119 User $user,
120 $timestamp,
121 array $targets = []
122 ) {
123 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
124 }
125
126 public function updateNotificationTimestamp( User $editor, LinkTarget $target, $timestamp ) {
127 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
128 }
129
130 public function resetAllNotificationTimestampsForUser( User $user ) {
131 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
132 }
133
134 public function resetNotificationTimestamp(
135 User $user,
136 Title $title,
137 $force = '',
138 $oldid = 0
139 ) {
140 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
141 }
142
143 public function clearUserWatchedItems( User $user ) {
144 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
145 }
146
147 public function clearUserWatchedItemsUsingJobQueue( User $user ) {
148 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
149 }
150
151 public function removeWatchBatchForUser( User $user, array $titles ) {
152 throw new DBReadOnlyError( null, self::DB_READONLY_ERROR );
153 }
154
155 }