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