Merge "Warn if stateful ParserOutput transforms are used"
[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 * Initialy set WatchedItemStore that will be used in cases where writing is not needed.
37 * @param WatchedItemStoreInterface $actualStore
38 */
39 public function __construct( WatchedItemStoreInterface $actualStore ) {
40 $this->actualStore = $actualStore;
41 }
42
43 public function countWatchedItems( User $user ) {
44 return $this->actualStore->countWatchedItems( $user );
45 }
46
47 public function countWatchers( LinkTarget $target ) {
48 return $this->actualStore->countWatchers( $target );
49 }
50
51 public function countVisitingWatchers( LinkTarget $target, $threshold ) {
52 return $this->actualStore->countVisitingWatchers( $target, $threshold );
53 }
54
55 public function countWatchersMultiple( array $targets, array $options = [] ) {
56 return $this->actualStore->countVisitingWatchersMultiple( $targets, $options );
57 }
58
59 public function countVisitingWatchersMultiple(
60 array $targetsWithVisitThresholds,
61 $minimumWatchers = null
62 ) {
63 return $this->actualStore->countVisitingWatchersMultiple(
64 $targetsWithVisitThresholds,
65 $minimumWatchers
66 );
67 }
68
69 public function getWatchedItem( User $user, LinkTarget $target ) {
70 return $this->actualStore->getWatchedItem( $user, $target );
71 }
72
73 public function loadWatchedItem( User $user, LinkTarget $target ) {
74 return $this->actualStore->loadWatchedItem( $user, $target );
75 }
76
77 public function getWatchedItemsForUser( User $user, array $options = [] ) {
78 return $this->actualStore->getWatchedItemsForUser( $user, $options );
79 }
80
81 public function isWatched( User $user, LinkTarget $target ) {
82 return $this->actualStore->isWatched( $user, $target );
83 }
84
85 public function getNotificationTimestampsBatch( User $user, array $targets ) {
86 return $this->actualStore->getNotificationTimestampsBatch( $user, $targets );
87 }
88
89 public function countUnreadNotifications( User $user, $unreadLimit = null ) {
90 return $this->actualStore->countUnreadNotifications( $user, $unreadLimit );
91 }
92
93 public function duplicateAllAssociatedEntries( LinkTarget $oldTarget, LinkTarget $newTarget ) {
94 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
95 }
96
97 public function duplicateEntry( LinkTarget $oldTarget, LinkTarget $newTarget ) {
98 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
99 }
100
101 public function addWatch( User $user, LinkTarget $target ) {
102 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
103 }
104
105 public function addWatchBatchForUser( User $user, array $targets ) {
106 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
107 }
108
109 public function removeWatch( User $user, LinkTarget $target ) {
110 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
111 }
112
113 public function setNotificationTimestampsForUser(
114 User $user,
115 $timestamp,
116 array $targets = []
117 ) {
118 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
119 }
120
121 public function updateNotificationTimestamp( User $editor, LinkTarget $target, $timestamp ) {
122 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
123 }
124
125 public function resetNotificationTimestamp(
126 User $user,
127 Title $title,
128 $force = '',
129 $oldid = 0
130 ) {
131 throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
132 }
133
134 }