|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Mediawiki\Api; |
|
4
|
|
|
|
|
5
|
|
|
use Mediawiki\Api\Service\CategoryTraverser; |
|
6
|
|
|
use Mediawiki\Api\Service\FileUploader; |
|
7
|
|
|
use Mediawiki\Api\Service\ImageRotator; |
|
8
|
|
|
use Mediawiki\Api\Service\LogListGetter; |
|
9
|
|
|
use Mediawiki\Api\Service\NamespaceGetter; |
|
10
|
|
|
use Mediawiki\Api\Service\PageDeleter; |
|
11
|
|
|
use Mediawiki\Api\Service\PageGetter; |
|
12
|
|
|
use Mediawiki\Api\Service\PageListGetter; |
|
13
|
|
|
use Mediawiki\Api\Service\PageMover; |
|
14
|
|
|
use Mediawiki\Api\Service\PageProtector; |
|
15
|
|
|
use Mediawiki\Api\Service\PagePurger; |
|
16
|
|
|
use Mediawiki\Api\Service\PageRestorer; |
|
17
|
|
|
use Mediawiki\Api\Service\PageWatcher; |
|
18
|
|
|
use Mediawiki\Api\Service\Parser; |
|
19
|
|
|
use Mediawiki\Api\Service\RevisionDeleter; |
|
20
|
|
|
use Mediawiki\Api\Service\RevisionPatroller; |
|
21
|
|
|
use Mediawiki\Api\Service\RevisionRestorer; |
|
22
|
|
|
use Mediawiki\Api\Service\RevisionRollbacker; |
|
23
|
|
|
use Mediawiki\Api\Service\RevisionSaver; |
|
24
|
|
|
use Mediawiki\Api\Service\RevisionUndoer; |
|
25
|
|
|
use Mediawiki\Api\Service\UserBlocker; |
|
26
|
|
|
use Mediawiki\Api\Service\UserCreator; |
|
27
|
|
|
use Mediawiki\Api\Service\UserGetter; |
|
28
|
|
|
use Mediawiki\Api\Service\UserRightsChanger; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @access public |
|
32
|
|
|
* |
|
33
|
|
|
* @author Addshore |
|
34
|
|
|
*/ |
|
35
|
|
|
class MediawikiFactory { |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var MediawikiApi |
|
39
|
|
|
*/ |
|
40
|
|
|
private $api; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @param MediawikiApi $api |
|
44
|
|
|
*/ |
|
45
|
15 |
|
public function __construct( MediawikiApi $api ) { |
|
46
|
15 |
|
$this->api = $api; |
|
47
|
15 |
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Get a new CategoryTraverser object for this API. |
|
51
|
|
|
* @return \Mediawiki\Api\Service\CategoryTraverser |
|
52
|
|
|
*/ |
|
53
|
4 |
|
public function newCategoryTraverser() { |
|
54
|
4 |
|
return new CategoryTraverser( $this->api ); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @since 0.3 |
|
59
|
|
|
* @return RevisionSaver |
|
60
|
|
|
*/ |
|
61
|
10 |
|
public function newRevisionSaver() { |
|
62
|
10 |
|
return new RevisionSaver( $this->api ); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @since 0.5 |
|
67
|
|
|
* @return RevisionUndoer |
|
68
|
|
|
*/ |
|
69
|
|
|
public function newRevisionUndoer() { |
|
70
|
|
|
return new RevisionUndoer( $this->api ); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @since 0.3 |
|
75
|
|
|
* @return PageGetter |
|
76
|
|
|
*/ |
|
77
|
8 |
|
public function newPageGetter() { |
|
78
|
8 |
|
return new PageGetter( $this->api ); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @since 0.3 |
|
83
|
|
|
* @return UserGetter |
|
84
|
|
|
*/ |
|
85
|
|
|
public function newUserGetter() { |
|
86
|
|
|
return new UserGetter( $this->api ); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @since 0.3 |
|
91
|
|
|
* @return PageDeleter |
|
92
|
|
|
*/ |
|
93
|
4 |
|
public function newPageDeleter() { |
|
94
|
4 |
|
return new PageDeleter( $this->api ); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @since 0.3 |
|
99
|
|
|
* @return PageMover |
|
100
|
|
|
*/ |
|
101
|
|
|
public function newPageMover() { |
|
102
|
|
|
return new PageMover( $this->api ); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @since 0.3 |
|
107
|
|
|
* @return PageListGetter |
|
108
|
|
|
*/ |
|
109
|
5 |
|
public function newPageListGetter() { |
|
110
|
5 |
|
return new PageListGetter( $this->api ); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @since 0.3 |
|
115
|
|
|
* @return PageRestorer |
|
116
|
|
|
*/ |
|
117
|
|
|
public function newPageRestorer() { |
|
118
|
|
|
return new PageRestorer( $this->api ); |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @since 0.3 |
|
123
|
|
|
* @return PagePurger |
|
124
|
|
|
*/ |
|
125
|
|
|
public function newPagePurger() { |
|
126
|
|
|
return new PagePurger( $this->api ); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* @since 0.3 |
|
131
|
|
|
* @return RevisionRollbacker |
|
132
|
|
|
*/ |
|
133
|
|
|
public function newRevisionRollbacker() { |
|
134
|
|
|
return new RevisionRollbacker( $this->api ); |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* @since 0.3 |
|
139
|
|
|
* @return RevisionPatroller |
|
140
|
|
|
*/ |
|
141
|
|
|
public function newRevisionPatroller() { |
|
142
|
|
|
return new RevisionPatroller( $this->api ); |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @since 0.3 |
|
147
|
|
|
* @return PageProtector |
|
148
|
|
|
*/ |
|
149
|
|
|
public function newPageProtector() { |
|
150
|
|
|
return new PageProtector( $this->api ); |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* @since 0.5 |
|
155
|
|
|
* @return PageWatcher |
|
156
|
|
|
*/ |
|
157
|
|
|
public function newPageWatcher() { |
|
158
|
|
|
return new PageWatcher( $this->api ); |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* @since 0.3 |
|
163
|
|
|
* @return RevisionDeleter |
|
164
|
|
|
*/ |
|
165
|
|
|
public function newRevisionDeleter() { |
|
166
|
|
|
return new RevisionDeleter( $this->api ); |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* @since 0.3 |
|
171
|
|
|
* @return RevisionRestorer |
|
172
|
|
|
*/ |
|
173
|
|
|
public function newRevisionRestorer() { |
|
174
|
|
|
return new RevisionRestorer( $this->api ); |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* @since 0.3 |
|
179
|
|
|
* @return UserBlocker |
|
180
|
|
|
*/ |
|
181
|
|
|
public function newUserBlocker() { |
|
182
|
|
|
return new UserBlocker( $this->api ); |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @since 0.3 |
|
187
|
|
|
* @return UserRightsChanger |
|
188
|
|
|
*/ |
|
189
|
|
|
public function newUserRightsChanger() { |
|
190
|
|
|
return new UserRightsChanger( $this->api ); |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* @since 0.5 |
|
195
|
|
|
* @return UserCreator |
|
196
|
|
|
*/ |
|
197
|
1 |
|
public function newUserCreator() { |
|
198
|
1 |
|
return new UserCreator( $this->api ); |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* @since 0.4 |
|
203
|
|
|
* @return LogListGetter |
|
204
|
|
|
*/ |
|
205
|
|
|
public function newLogListGetter() { |
|
206
|
|
|
return new LogListGetter( $this->api ); |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
/** |
|
210
|
|
|
* @since 0.5 |
|
211
|
|
|
* @return FileUploader |
|
212
|
|
|
*/ |
|
213
|
2 |
|
public function newFileUploader() { |
|
214
|
2 |
|
return new FileUploader( $this->api ); |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
/** |
|
218
|
|
|
* @since 0.5 |
|
219
|
|
|
* @return ImageRotator |
|
220
|
|
|
*/ |
|
221
|
|
|
public function newImageRotator() { |
|
222
|
|
|
return new ImageRotator( $this->api ); |
|
223
|
|
|
} |
|
224
|
|
|
|
|
225
|
|
|
/** |
|
226
|
|
|
* @since 0.6 |
|
227
|
|
|
* @return Parser |
|
228
|
|
|
*/ |
|
229
|
|
|
public function newParser() { |
|
230
|
|
|
return new Parser( $this->api ); |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
/** |
|
234
|
|
|
* @since 0.7 |
|
235
|
|
|
* @return NamespaceGetter |
|
236
|
|
|
*/ |
|
237
|
|
|
public function newNamespaceGetter() { |
|
238
|
|
|
return new NamespaceGetter( $this->api ); |
|
239
|
|
|
} |
|
240
|
|
|
} |
|
241
|
|
|
|