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