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