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