documentation, a couple notes about code and some whitespaces adjustements to make...
[lhc/web/wiklou.git] / includes / api / ApiQueryInfo.php
1 <?php
2 /**
3 * API for MediaWiki 1.8+
4 *
5 * Created on Sep 25, 2006
6 *
7 * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
23 *
24 * @file
25 */
26
27 if ( !defined( 'MEDIAWIKI' ) ) {
28 // Eclipse helper - will be ignored in production
29 require_once( 'ApiQueryBase.php' );
30 }
31
32 /**
33 * A query module to show basic page information.
34 *
35 * @ingroup API
36 */
37 class ApiQueryInfo extends ApiQueryBase {
38
39 private $fld_protection = false, $fld_talkid = false,
40 $fld_subjectid = false, $fld_url = false,
41 $fld_readable = false, $fld_watched = false,
42 $fld_preload = false, $fld_displaytitle = false;
43
44 private $tokenFunctions;
45
46 public function __construct( $query, $moduleName ) {
47 parent::__construct( $query, $moduleName, 'in' );
48 }
49
50 public function requestExtraData( $pageSet ) {
51 $pageSet->requestField( 'page_restrictions' );
52 $pageSet->requestField( 'page_is_redirect' );
53 $pageSet->requestField( 'page_is_new' );
54 $pageSet->requestField( 'page_counter' );
55 $pageSet->requestField( 'page_touched' );
56 $pageSet->requestField( 'page_latest' );
57 $pageSet->requestField( 'page_len' );
58 }
59
60 /**
61 * Get an array mapping token names to their handler functions.
62 * The prototype for a token function is func($pageid, $title)
63 * it should return a token or false (permission denied)
64 * @return array(tokenname => function)
65 */
66 protected function getTokenFunctions() {
67 // Don't call the hooks twice
68 if ( isset( $this->tokenFunctions ) ) {
69 return $this->tokenFunctions;
70 }
71
72 // If we're in JSON callback mode, no tokens can be obtained
73 if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
74 return array();
75 }
76
77 $this->tokenFunctions = array(
78 'edit' => array( 'ApiQueryInfo', 'getEditToken' ),
79 'delete' => array( 'ApiQueryInfo', 'getDeleteToken' ),
80 'protect' => array( 'ApiQueryInfo', 'getProtectToken' ),
81 'move' => array( 'ApiQueryInfo', 'getMoveToken' ),
82 'block' => array( 'ApiQueryInfo', 'getBlockToken' ),
83 'unblock' => array( 'ApiQueryInfo', 'getUnblockToken' ),
84 'email' => array( 'ApiQueryInfo', 'getEmailToken' ),
85 'import' => array( 'ApiQueryInfo', 'getImportToken' ),
86 );
87 wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) );
88 return $this->tokenFunctions;
89 }
90
91 public static function getEditToken( $pageid, $title ) {
92 // We could check for $title->userCan('edit') here,
93 // but that's too expensive for this purpose
94 // and would break caching
95 global $wgUser;
96 if ( !$wgUser->isAllowed( 'edit' ) ) {
97 return false;
98 }
99
100 // The edit token is always the same, let's exploit that
101 static $cachedEditToken = null;
102 if ( !is_null( $cachedEditToken ) ) {
103 return $cachedEditToken;
104 }
105
106 $cachedEditToken = $wgUser->editToken();
107 return $cachedEditToken;
108 }
109
110 public static function getDeleteToken( $pageid, $title ) {
111 global $wgUser;
112 if ( !$wgUser->isAllowed( 'delete' ) ) {
113 return false;
114 }
115
116 static $cachedDeleteToken = null;
117 if ( !is_null( $cachedDeleteToken ) ) {
118 return $cachedDeleteToken;
119 }
120
121 $cachedDeleteToken = $wgUser->editToken();
122 return $cachedDeleteToken;
123 }
124
125 public static function getProtectToken( $pageid, $title ) {
126 global $wgUser;
127 if ( !$wgUser->isAllowed( 'protect' ) ) {
128 return false;
129 }
130
131 static $cachedProtectToken = null;
132 if ( !is_null( $cachedProtectToken ) ) {
133 return $cachedProtectToken;
134 }
135
136 $cachedProtectToken = $wgUser->editToken();
137 return $cachedProtectToken;
138 }
139
140 public static function getMoveToken( $pageid, $title ) {
141 global $wgUser;
142 if ( !$wgUser->isAllowed( 'move' ) ) {
143 return false;
144 }
145
146 static $cachedMoveToken = null;
147 if ( !is_null( $cachedMoveToken ) ) {
148 return $cachedMoveToken;
149 }
150
151 $cachedMoveToken = $wgUser->editToken();
152 return $cachedMoveToken;
153 }
154
155 public static function getBlockToken( $pageid, $title ) {
156 global $wgUser;
157 if ( !$wgUser->isAllowed( 'block' ) ) {
158 return false;
159 }
160
161 static $cachedBlockToken = null;
162 if ( !is_null( $cachedBlockToken ) ) {
163 return $cachedBlockToken;
164 }
165
166 $cachedBlockToken = $wgUser->editToken();
167 return $cachedBlockToken;
168 }
169
170 public static function getUnblockToken( $pageid, $title ) {
171 // Currently, this is exactly the same as the block token
172 return self::getBlockToken( $pageid, $title );
173 }
174
175 public static function getEmailToken( $pageid, $title ) {
176 global $wgUser;
177 if ( !$wgUser->canSendEmail() || $wgUser->isBlockedFromEmailUser() ) {
178 return false;
179 }
180
181 static $cachedEmailToken = null;
182 if ( !is_null( $cachedEmailToken ) ) {
183 return $cachedEmailToken;
184 }
185
186 $cachedEmailToken = $wgUser->editToken();
187 return $cachedEmailToken;
188 }
189
190 public static function getImportToken( $pageid, $title ) {
191 global $wgUser;
192 if ( !$wgUser->isAllowed( 'import' ) ) {
193 return false;
194 }
195
196 static $cachedImportToken = null;
197 if ( !is_null( $cachedImportToken ) ) {
198 return $cachedImportToken;
199 }
200
201 $cachedImportToken = $wgUser->editToken();
202 return $cachedImportToken;
203 }
204
205 public function execute() {
206 $this->params = $this->extractRequestParams();
207 if ( !is_null( $this->params['prop'] ) ) {
208 $prop = array_flip( $this->params['prop'] );
209 $this->fld_protection = isset( $prop['protection'] );
210 $this->fld_watched = isset( $prop['watched'] );
211 $this->fld_talkid = isset( $prop['talkid'] );
212 $this->fld_subjectid = isset( $prop['subjectid'] );
213 $this->fld_url = isset( $prop['url'] );
214 $this->fld_readable = isset( $prop['readable'] );
215 $this->fld_preload = isset( $prop['preload'] );
216 $this->fld_displaytitle = isset( $prop['displaytitle'] );
217 }
218
219 $pageSet = $this->getPageSet();
220 $this->titles = $pageSet->getGoodTitles();
221 $this->missing = $pageSet->getMissingTitles();
222 $this->everything = $this->titles + $this->missing;
223 $result = $this->getResult();
224
225 uasort( $this->everything, array( 'Title', 'compare' ) );
226 if ( !is_null( $this->params['continue'] ) ) {
227 // Throw away any titles we're gonna skip so they don't
228 // clutter queries
229 $cont = explode( '|', $this->params['continue'] );
230 if ( count( $cont ) != 2 ) {
231 $this->dieUsage( 'Invalid continue param. You should pass the original ' .
232 'value returned by the previous query', '_badcontinue' );
233 }
234 $conttitle = Title::makeTitleSafe( $cont[0], $cont[1] );
235 foreach ( $this->everything as $pageid => $title ) {
236 if ( Title::compare( $title, $conttitle ) >= 0 ) {
237 break;
238 }
239 unset( $this->titles[$pageid] );
240 unset( $this->missing[$pageid] );
241 unset( $this->everything[$pageid] );
242 }
243 }
244
245 $this->pageRestrictions = $pageSet->getCustomField( 'page_restrictions' );
246 $this->pageIsRedir = $pageSet->getCustomField( 'page_is_redirect' );
247 $this->pageIsNew = $pageSet->getCustomField( 'page_is_new' );
248 $this->pageCounter = $pageSet->getCustomField( 'page_counter' );
249 $this->pageTouched = $pageSet->getCustomField( 'page_touched' );
250 $this->pageLatest = $pageSet->getCustomField( 'page_latest' );
251 $this->pageLength = $pageSet->getCustomField( 'page_len' );
252
253 // Get protection info if requested
254 if ( $this->fld_protection ) {
255 $this->getProtectionInfo();
256 }
257
258 if ( $this->fld_watched ) {
259 $this->getWatchedInfo();
260 }
261
262 // Run the talkid/subjectid query if requested
263 if ( $this->fld_talkid || $this->fld_subjectid ) {
264 $this->getTSIDs();
265 }
266
267 if ( $this->fld_displaytitle ) {
268 $this->getDisplayTitle();
269 }
270
271 foreach ( $this->everything as $pageid => $title ) {
272 $pageInfo = $this->extractPageInfo( $pageid, $title );
273 $fit = $result->addValue( array(
274 'query',
275 'pages'
276 ), $pageid, $pageInfo );
277 if ( !$fit ) {
278 $this->setContinueEnumParameter( 'continue',
279 $title->getNamespace() . '|' .
280 $title->getText() );
281 break;
282 }
283 }
284 }
285
286 /**
287 * Get a result array with information about a title
288 * @param $pageid int Page ID (negative for missing titles)
289 * @param $title Title object
290 * @return array
291 */
292 private function extractPageInfo( $pageid, $title ) {
293 $pageInfo = array();
294 if ( $title->exists() ) {
295 $pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
296 $pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] );
297 $pageInfo['counter'] = intval( $this->pageCounter[$pageid] );
298 $pageInfo['length'] = intval( $this->pageLength[$pageid] );
299
300 if ( $this->pageIsRedir[$pageid] ) {
301 $pageInfo['redirect'] = '';
302 }
303 if ( $this->pageIsNew[$pageid] ) {
304 $pageInfo['new'] = '';
305 }
306 }
307
308 if ( !is_null( $this->params['token'] ) ) {
309 $tokenFunctions = $this->getTokenFunctions();
310 $pageInfo['starttimestamp'] = wfTimestamp( TS_ISO_8601, time() );
311 foreach ( $this->params['token'] as $t ) {
312 $val = call_user_func( $tokenFunctions[$t], $pageid, $title );
313 if ( $val === false ) {
314 $this->setWarning( "Action '$t' is not allowed for the current user" );
315 } else {
316 $pageInfo[$t . 'token'] = $val;
317 }
318 }
319 }
320
321 if ( $this->fld_protection ) {
322 $pageInfo['protection'] = array();
323 if ( isset( $this->protections[$title->getNamespace()][$title->getDBkey()] ) ) {
324 $pageInfo['protection'] =
325 $this->protections[$title->getNamespace()][$title->getDBkey()];
326 }
327 $this->getResult()->setIndexedTagName( $pageInfo['protection'], 'pr' );
328 }
329
330 if ( $this->fld_watched && isset( $this->watched[$title->getNamespace()][$title->getDBkey()] ) ) {
331 $pageInfo['watched'] = '';
332 }
333
334 if ( $this->fld_talkid && isset( $this->talkids[$title->getNamespace()][$title->getDBkey()] ) ) {
335 $pageInfo['talkid'] = $this->talkids[$title->getNamespace()][$title->getDBkey()];
336 }
337
338 if ( $this->fld_subjectid && isset( $this->subjectids[$title->getNamespace()][$title->getDBkey()] ) ) {
339 $pageInfo['subjectid'] = $this->subjectids[$title->getNamespace()][$title->getDBkey()];
340 }
341
342 if ( $this->fld_url ) {
343 $pageInfo['fullurl'] = $title->getFullURL();
344 $pageInfo['editurl'] = $title->getFullURL( 'action=edit' );
345 }
346 if ( $this->fld_readable && $title->userCanRead() ) {
347 $pageInfo['readable'] = '';
348 }
349
350 if ( $this->fld_preload ) {
351 if ( $title->exists() ) {
352 $pageInfo['preload'] = '';
353 } else {
354 $text = null;
355 wfRunHooks( 'EditFormPreloadText', array( &$text, &$title ) );
356
357 $pageInfo['preload'] = $text;
358 }
359 }
360
361 if ( $this->fld_displaytitle ) {
362 if ( isset( $this->displaytitles[$title->getArticleId()] ) ) {
363 $pageInfo['displaytitle'] = $this->displaytitles[$title->getArticleId()];
364 } else {
365 $pageInfo['displaytitle'] = $title->getPrefixedText();
366 }
367 }
368
369 return $pageInfo;
370 }
371
372 /**
373 * Get information about protections and put it in $protections
374 */
375 private function getProtectionInfo() {
376 $this->protections = array();
377 $db = $this->getDB();
378
379 // Get normal protections for existing titles
380 if ( count( $this->titles ) ) {
381 $this->resetQueryParams();
382 $this->addTables( array( 'page_restrictions', 'page' ) );
383 $this->addWhere( 'page_id=pr_page' );
384 $this->addFields( array( 'pr_page', 'pr_type', 'pr_level',
385 'pr_expiry', 'pr_cascade', 'page_namespace',
386 'page_title' ) );
387 $this->addWhereFld( 'pr_page', array_keys( $this->titles ) );
388
389 $res = $this->select( __METHOD__ );
390 foreach ( $res as $row ) {
391 $a = array(
392 'type' => $row->pr_type,
393 'level' => $row->pr_level,
394 'expiry' => Block::decodeExpiry( $row->pr_expiry, TS_ISO_8601 )
395 );
396 if ( $row->pr_cascade ) {
397 $a['cascade'] = '';
398 }
399 $this->protections[$row->page_namespace][$row->page_title][] = $a;
400
401 // Also check old restrictions
402 if ( $this->pageRestrictions[$row->pr_page] ) {
403 $restrictions = explode( ':', trim( $this->pageRestrictions[$row->pr_page] ) );
404 foreach ( $restrictions as $restrict ) {
405 $temp = explode( '=', trim( $restrict ) );
406 if ( count( $temp ) == 1 ) {
407 // old old format should be treated as edit/move restriction
408 $restriction = trim( $temp[0] );
409
410 if ( $restriction == '' ) {
411 continue;
412 }
413 $this->protections[$row->page_namespace][$row->page_title][] = array(
414 'type' => 'edit',
415 'level' => $restriction,
416 'expiry' => 'infinity',
417 );
418 $this->protections[$row->page_namespace][$row->page_title][] = array(
419 'type' => 'move',
420 'level' => $restriction,
421 'expiry' => 'infinity',
422 );
423 } else {
424 $restriction = trim( $temp[1] );
425 if ( $restriction == '' ) {
426 continue;
427 }
428 $this->protections[$row->page_namespace][$row->page_title][] = array(
429 'type' => $temp[0],
430 'level' => $restriction,
431 'expiry' => 'infinity',
432 );
433 }
434 }
435 }
436 }
437 }
438
439 // Get protections for missing titles
440 if ( count( $this->missing ) ) {
441 $this->resetQueryParams();
442 $lb = new LinkBatch( $this->missing );
443 $this->addTables( 'protected_titles' );
444 $this->addFields( array( 'pt_title', 'pt_namespace', 'pt_create_perm', 'pt_expiry' ) );
445 $this->addWhere( $lb->constructSet( 'pt', $db ) );
446 $res = $this->select( __METHOD__ );
447 foreach ( $res as $row ) {
448 $this->protections[$row->pt_namespace][$row->pt_title][] = array(
449 'type' => 'create',
450 'level' => $row->pt_create_perm,
451 'expiry' => Block::decodeExpiry( $row->pt_expiry, TS_ISO_8601 )
452 );
453 }
454 }
455
456 // Cascading protections
457 $images = $others = array();
458 foreach ( $this->everything as $title ) {
459 if ( $title->getNamespace() == NS_FILE ) {
460 $images[] = $title->getDBkey();
461 } else {
462 $others[] = $title;
463 }
464 }
465
466 if ( count( $others ) ) {
467 // Non-images: check templatelinks
468 $lb = new LinkBatch( $others );
469 $this->resetQueryParams();
470 $this->addTables( array( 'page_restrictions', 'page', 'templatelinks' ) );
471 $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
472 'page_title', 'page_namespace',
473 'tl_title', 'tl_namespace' ) );
474 $this->addWhere( $lb->constructSet( 'tl', $db ) );
475 $this->addWhere( 'pr_page = page_id' );
476 $this->addWhere( 'pr_page = tl_from' );
477 $this->addWhereFld( 'pr_cascade', 1 );
478
479 $res = $this->select( __METHOD__ );
480 foreach ( $res as $row ) {
481 $source = Title::makeTitle( $row->page_namespace, $row->page_title );
482 $this->protections[$row->tl_namespace][$row->tl_title][] = array(
483 'type' => $row->pr_type,
484 'level' => $row->pr_level,
485 'expiry' => Block::decodeExpiry( $row->pr_expiry, TS_ISO_8601 ),
486 'source' => $source->getPrefixedText()
487 );
488 }
489 }
490
491 if ( count( $images ) ) {
492 // Images: check imagelinks
493 $this->resetQueryParams();
494 $this->addTables( array( 'page_restrictions', 'page', 'imagelinks' ) );
495 $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
496 'page_title', 'page_namespace', 'il_to' ) );
497 $this->addWhere( 'pr_page = page_id' );
498 $this->addWhere( 'pr_page = il_from' );
499 $this->addWhereFld( 'pr_cascade', 1 );
500 $this->addWhereFld( 'il_to', $images );
501
502 $res = $this->select( __METHOD__ );
503 foreach ( $res as $row ) {
504 $source = Title::makeTitle( $row->page_namespace, $row->page_title );
505 $this->protections[NS_FILE][$row->il_to][] = array(
506 'type' => $row->pr_type,
507 'level' => $row->pr_level,
508 'expiry' => Block::decodeExpiry( $row->pr_expiry, TS_ISO_8601 ),
509 'source' => $source->getPrefixedText()
510 );
511 }
512 }
513 }
514
515 /**
516 * Get talk page IDs (if requested) and subject page IDs (if requested)
517 * and put them in $talkids and $subjectids
518 */
519 private function getTSIDs() {
520 $getTitles = $this->talkids = $this->subjectids = array();
521
522 foreach ( $this->everything as $t ) {
523 if ( MWNamespace::isTalk( $t->getNamespace() ) ) {
524 if ( $this->fld_subjectid ) {
525 $getTitles[] = $t->getSubjectPage();
526 }
527 } elseif ( $this->fld_talkid ) {
528 $getTitles[] = $t->getTalkPage();
529 }
530 }
531 if ( !count( $getTitles ) ) {
532 return;
533 }
534
535 $db = $this->getDB();
536
537 // Construct a custom WHERE clause that matches
538 // all titles in $getTitles
539 $lb = new LinkBatch( $getTitles );
540 $this->resetQueryParams();
541 $this->addTables( 'page' );
542 $this->addFields( array( 'page_title', 'page_namespace', 'page_id' ) );
543 $this->addWhere( $lb->constructSet( 'page', $db ) );
544 $res = $this->select( __METHOD__ );
545 foreach ( $res as $row ) {
546 if ( MWNamespace::isTalk( $row->page_namespace ) ) {
547 $this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] =
548 intval( $row->page_id );
549 } else {
550 $this->subjectids[MWNamespace::getTalk( $row->page_namespace )][$row->page_title] =
551 intval( $row->page_id );
552 }
553 }
554 }
555
556 private function getDisplayTitle() {
557 $this->displaytitles = array();
558
559 $pageIds = array_keys( $this->titles );
560
561 if ( !count( $pageIds ) ) {
562 return;
563 }
564
565 $this->resetQueryParams();
566 $this->addTables( 'page_props' );
567 $this->addFields( array( 'pp_page', 'pp_value' ) );
568 $this->addWhereFld( 'pp_page', $pageIds );
569 $this->addWhereFld( 'pp_propname', 'displaytitle' );
570 $res = $this->select( __METHOD__ );
571
572 foreach ( $res as $row ) {
573 $this->displaytitles[$row->pp_page] = $row->pp_value;
574 }
575 }
576
577 /**
578 * Get information about watched status and put it in $this->watched
579 */
580 private function getWatchedInfo() {
581 global $wgUser;
582
583 if ( $wgUser->isAnon() || count( $this->titles ) == 0 ) {
584 return;
585 }
586
587 $this->watched = array();
588 $db = $this->getDB();
589
590 $lb = new LinkBatch( $this->titles );
591
592 $this->resetQueryParams();
593 $this->addTables( array( 'page', 'watchlist' ) );
594 $this->addFields( array( 'page_title', 'page_namespace' ) );
595 $this->addWhere( array(
596 $lb->constructSet( 'page', $db ),
597 'wl_namespace=page_namespace',
598 'wl_title=page_title',
599 'wl_user' => $wgUser->getID()
600 ) );
601
602 $res = $this->select( __METHOD__ );
603
604 foreach ( $res as $row ) {
605 $this->watched[$row->page_namespace][$row->page_title] = true;
606 }
607 }
608
609 public function getCacheMode( $params ) {
610 $publicProps = array(
611 'protection',
612 'talkid',
613 'subjectid',
614 'url',
615 'preload',
616 'displaytitle',
617 );
618 if ( !is_null( $params['prop'] ) ) {
619 foreach ( $params['prop'] as $prop ) {
620 if ( !in_array( $prop, $publicProps ) ) {
621 return 'private';
622 }
623 }
624 }
625 if ( !is_null( $params['token'] ) ) {
626 return 'private';
627 }
628 return 'public';
629 }
630
631 public function getAllowedParams() {
632 return array(
633 'prop' => array(
634 ApiBase::PARAM_DFLT => null,
635 ApiBase::PARAM_ISMULTI => true,
636 ApiBase::PARAM_TYPE => array(
637 'protection',
638 'talkid',
639 'watched', # private
640 'subjectid',
641 'url',
642 'readable', # private
643 'preload',
644 'displaytitle',
645 // If you add more properties here, please consider whether they
646 // need to be added to getCacheMode()
647 ) ),
648 'token' => array(
649 ApiBase::PARAM_DFLT => null,
650 ApiBase::PARAM_ISMULTI => true,
651 ApiBase::PARAM_TYPE => array_keys( $this->getTokenFunctions() )
652 ),
653 'continue' => null,
654 );
655 }
656
657 public function getParamDescription() {
658 return array(
659 'prop' => array(
660 'Which additional properties to get:',
661 ' protection - List the protection level of each page',
662 ' talkid - The page ID of the talk page for each non-talk page',
663 ' watched - List the watched status of each page',
664 ' subjectid - The page ID of the parent page for each talk page',
665 ' url - Gives a full URL to the page, and also an edit URL',
666 ' readable - Whether the user can read this page',
667 ' preload - Gives the text returned by EditFormPreloadText',
668 ' displaytitle - Gives the way the page title is actually displayed',
669 ),
670 'token' => 'Request a token to perform a data-modifying action on a page',
671 'continue' => 'When more results are available, use this to continue',
672 );
673 }
674
675 public function getDescription() {
676 return 'Get basic page information such as namespace, title, last touched date, ...';
677 }
678
679 public function getPossibleErrors() {
680 return array_merge( parent::getPossibleErrors(), array(
681 array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
682 ) );
683 }
684
685 protected function getExamples() {
686 return array(
687 'api.php?action=query&prop=info&titles=Main%20Page',
688 'api.php?action=query&prop=info&inprop=protection&titles=Main%20Page'
689 );
690 }
691
692 public function getVersion() {
693 return __CLASS__ . ': $Id$';
694 }
695 }