sites.php
7.4 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<?php
/**
* @package Joomla.Platform
* @subpackage MediaWiki
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* MediaWiki API Sites class for the Joomla Platform.
*
* @since 3.1.4
*/
class JMediawikiSites extends JMediawikiObject
{
/**
* Method to get site information.
*
* @param array $siprop The sysinfo properties to get.
* @param string $sifilteriw Only local or only non local entries to return.
* @param boolean $sishowalldb List all database servers.
* @param boolean $sinumberingroup List the number of users in usergroups.
* @param array $siinlanguagecode Language code for localized languages.
*
* @return object
*
* @since 3.1.4
*/
public function getSiteInfo(array $siprop = null, $sifilteriw = null, $sishowalldb = false, $sinumberingroup = false, array $siinlanguagecode = null)
{
// Build the request.
$path = '?action=query&meta=siteinfo';
if (isset($siprop))
{
$path .= '&siprop=' . $this->buildParameter($siprop);
}
if (isset($sifilteriw))
{
$path .= '&sifilteriw=' . $sifilteriw;
}
if ($sishowalldb)
{
$path .= '&sishowalldb=';
}
if ($sinumberingroup)
{
$path .= '&sinumberingroup=';
}
if (isset($siinlanguagecode))
{
$path .= '&siinlanguagecode=' . $this->buildParameter($siinlanguagecode);
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get events from logs.
*
* @param array $leprop List of properties to get.
* @param string $letype Filter log actions to only this type.
* @param string $leaction Filter log actions to only this type.
* @param string $letitle Filter entries to those related to a page.
* @param string $leprefix Filter entries that start with this prefix.
* @param string $letag Filter entries with tag.
* @param string $leuser Filter entries made by the given user.
* @param string $lestart Starting timestamp.
* @param string $leend Ending timestamp.
* @param string $ledir Direction of enumeration.
* @param integer $lelimit Event limit to return.
*
* @return object
*
* @since 3.1.4
*/
public function getEvents(array $leprop = null, $letype = null, $leaction = null, $letitle = null, $leprefix = null, $letag = null,
$leuser = null, $lestart = null, $leend = null, $ledir = null, $lelimit = null)
{
// Build the request
$path = '?action=query&list=logevents';
if (isset($leprop))
{
$path .= '&leprop=' . $this->buildParameter($leprop);
}
if (isset($letype))
{
$path .= '&letype=' . $letype;
}
if (isset($leaction))
{
$path .= '&leaction=' . $leaction;
}
if (isset($letitle))
{
$path .= '&letitle=' . $letitle;
}
if (isset($leprefix))
{
$path .= '&leprefix=' . $leprefix;
}
if (isset($letag))
{
$path .= '&letag=' . $letag;
}
if (isset($leuser))
{
$path .= '&leuser=' . $leuser;
}
if (isset($lestart))
{
$path .= '&lestart=' . $lestart;
}
if (isset($leend))
{
$path .= '&leend=' . $leend;
}
if (isset($ledir))
{
$path .= '&ledir=' . $ledir;
}
if (isset($lelimit))
{
$path .= '&lelimit=' . $lelimit;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get recent changes on a site.
*
* @param string $rcstart Starting timestamp.
* @param string $rcend Ending timestamp.
* @param string $rcdir Direction of enumeration.
* @param array $rcnamespace Filter changes to only this namespace(s).
* @param string $rcuser Filter changes by this user.
* @param string $rcexcludeuser Filter changes to exclude changes by this user.
* @param string $rctag Filter changes by this tag.
* @param array $rcprop Filter log actions to only this type.
* @param array $rctoken Which token to obtain for each change.
* @param array $rcshow Filter changes by this criteria.
* @param string $rclimit Changes limit to return.
* @param string $rctype Filter event by type of changes.
* @param string $rctoponly Filter changes which are latest revision.
*
* @return object
*
* @since 3.1.4
*/
public function getRecentChanges($rcstart = null, $rcend = null, $rcdir = null, array $rcnamespace = null, $rcuser = null, $rcexcludeuser = null,
$rctag = null, array $rcprop = null, array $rctoken = null, array $rcshow = null, $rclimit = null, $rctype = null, $rctoponly = null)
{
// Build the request.
$path = '?action=query&list=recentchanges';
if (isset($rcstart))
{
$path .= '&rcstart=' . $rcstart;
}
if (isset($rcend))
{
$path .= '&rcend=' . $rcend;
}
if (isset($rcdir))
{
$path .= '&rcdir=' . $rcdir;
}
if (isset($rcnamespace))
{
$path .= '&rcnamespaces=' . $this->buildParameter($rcnamespace);
}
if (isset($rcuser))
{
$path .= '&rcuser=' . $rcuser;
}
if (isset($rcexcludeuser))
{
$path .= '&rcexcludeuser=' . $rcexcludeuser;
}
if (isset($rctag))
{
$path .= '&rctag=' . $rctag;
}
if (isset($rcprop))
{
$path .= '&rcprop=' . $this->buildParameter($rcprop);
}
if (isset($rctoken))
{
$path .= '&rctoken=' . $this->buildParameter($rctoken);
}
if (isset($rcshow))
{
$path .= '&rcshow=' . $this->buildParameter($rcshow);
}
if (isset($rclimit))
{
$path .= '&rclimit=' . $rclimit;
}
if (isset($rctype))
{
$path .= '&rctype=' . $rctype;
}
if (isset($rctoponly))
{
$path .= '&rctoponly=' . $rctoponly;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get protected titles on a site.
*
* @param array $ptnamespace Only list titles in this namespace.
* @param array $ptlevel Only list titles with these protection level.
* @param integer $ptlimit Limit of pages to return.
* @param string $ptdir Direction of enumeration.
* @param string $ptstart Starting timestamp.
* @param string $ptend Ending timestamp.
* @param array $ptprop List of properties to get.
*
* @return object
*
* @since 3.1.4
*/
public function getProtectedTitles(array $ptnamespace = null, array $ptlevel = null, $ptlimit = null, $ptdir = null, $ptstart = null,
$ptend = null, array $ptprop = null)
{
// Build the request.
$path = '?action=query&list=protectedtitles';
if (isset($ptnamespace))
{
$path .= '&ptnamespace=' . $this->buildParameter($ptnamespace);
}
if (isset($ptlevel))
{
$path .= '&ptlevel=' . $this->buildParameter($ptlevel);
}
if (isset($ptlimit))
{
$path .= '&ptlimit=' . $ptlimit;
}
if (isset($ptdir))
{
$path .= '&ptdir=' . $ptdir;
}
if (isset($ptstart))
{
$path .= '&ptstart=' . $ptstart;
}
if (isset($ptend))
{
$path .= '&ptend=' . $ptend;
}
if (isset($ptprop))
{
$path .= '&ptprop=' . $this->buildParameter($ptprop);
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
}