5 * Created on Sep 25, 2006
7 * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
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.
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.
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
28 * A query module to show basic page information.
32 class ApiQueryInfo
extends ApiQueryBase
{
34 private $fld_protection = false, $fld_talkid = false,
35 $fld_subjectid = false, $fld_url = false,
36 $fld_readable = false, $fld_watched = false,
37 $fld_preload = false, $fld_displaytitle = false;
39 private $params, $titles, $missing, $everything, $pageCounter;
41 private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
42 $pageLatest, $pageLength;
44 private $protections, $watched, $talkids, $subjectids, $displaytitles;
46 private $tokenFunctions;
48 public function __construct( $query, $moduleName ) {
49 parent
::__construct( $query, $moduleName, 'in' );
53 * @param $pageSet ApiPageSet
56 public function requestExtraData( $pageSet ) {
57 global $wgDisableCounters;
59 $pageSet->requestField( 'page_restrictions' );
60 $pageSet->requestField( 'page_is_redirect' );
61 $pageSet->requestField( 'page_is_new' );
62 if ( !$wgDisableCounters ) {
63 $pageSet->requestField( 'page_counter' );
65 $pageSet->requestField( 'page_touched' );
66 $pageSet->requestField( 'page_latest' );
67 $pageSet->requestField( 'page_len' );
71 * Get an array mapping token names to their handler functions.
72 * The prototype for a token function is func($pageid, $title)
73 * it should return a token or false (permission denied)
74 * @return array array(tokenname => function)
76 protected function getTokenFunctions() {
77 // Don't call the hooks twice
78 if ( isset( $this->tokenFunctions
) ) {
79 return $this->tokenFunctions
;
82 // If we're in JSON callback mode, no tokens can be obtained
83 if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
87 $this->tokenFunctions
= array(
88 'edit' => array( 'ApiQueryInfo', 'getEditToken' ),
89 'delete' => array( 'ApiQueryInfo', 'getDeleteToken' ),
90 'protect' => array( 'ApiQueryInfo', 'getProtectToken' ),
91 'move' => array( 'ApiQueryInfo', 'getMoveToken' ),
92 'block' => array( 'ApiQueryInfo', 'getBlockToken' ),
93 'unblock' => array( 'ApiQueryInfo', 'getUnblockToken' ),
94 'email' => array( 'ApiQueryInfo', 'getEmailToken' ),
95 'import' => array( 'ApiQueryInfo', 'getImportToken' ),
96 'watch' => array( 'ApiQueryInfo', 'getWatchToken'),
98 wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions
) );
99 return $this->tokenFunctions
;
102 static $cachedTokens = array();
104 public static function resetTokenCache() {
105 ApiQueryInfo
::$cachedTokens = array();
108 public static function getEditToken( $pageid, $title ) {
109 // We could check for $title->userCan('edit') here,
110 // but that's too expensive for this purpose
111 // and would break caching
113 if ( !$wgUser->isAllowed( 'edit' ) ) {
117 // The token is always the same, let's exploit that
118 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'edit' ] ) ) {
119 ApiQueryInfo
::$cachedTokens[ 'edit' ] = $wgUser->getEditToken();
122 return ApiQueryInfo
::$cachedTokens[ 'edit' ];
125 public static function getDeleteToken( $pageid, $title ) {
127 if ( !$wgUser->isAllowed( 'delete' ) ) {
131 // The token is always the same, let's exploit that
132 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'delete' ] ) ) {
133 ApiQueryInfo
::$cachedTokens[ 'delete' ] = $wgUser->getEditToken();
136 return ApiQueryInfo
::$cachedTokens[ 'delete' ];
139 public static function getProtectToken( $pageid, $title ) {
141 if ( !$wgUser->isAllowed( 'protect' ) ) {
145 // The token is always the same, let's exploit that
146 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'protect' ] ) ) {
147 ApiQueryInfo
::$cachedTokens[ 'protect' ] = $wgUser->getEditToken();
150 return ApiQueryInfo
::$cachedTokens[ 'protect' ];
153 public static function getMoveToken( $pageid, $title ) {
155 if ( !$wgUser->isAllowed( 'move' ) ) {
159 // The token is always the same, let's exploit that
160 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'move' ] ) ) {
161 ApiQueryInfo
::$cachedTokens[ 'move' ] = $wgUser->getEditToken();
164 return ApiQueryInfo
::$cachedTokens[ 'move' ];
167 public static function getBlockToken( $pageid, $title ) {
169 if ( !$wgUser->isAllowed( 'block' ) ) {
173 // The token is always the same, let's exploit that
174 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'block' ] ) ) {
175 ApiQueryInfo
::$cachedTokens[ 'block' ] = $wgUser->getEditToken();
178 return ApiQueryInfo
::$cachedTokens[ 'block' ];
181 public static function getUnblockToken( $pageid, $title ) {
182 // Currently, this is exactly the same as the block token
183 return self
::getBlockToken( $pageid, $title );
186 public static function getEmailToken( $pageid, $title ) {
188 if ( !$wgUser->canSendEmail() ||
$wgUser->isBlockedFromEmailUser() ) {
192 // The token is always the same, let's exploit that
193 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'email' ] ) ) {
194 ApiQueryInfo
::$cachedTokens[ 'email' ] = $wgUser->getEditToken();
197 return ApiQueryInfo
::$cachedTokens[ 'email' ];
200 public static function getImportToken( $pageid, $title ) {
202 if ( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) {
206 // The token is always the same, let's exploit that
207 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'import' ] ) ) {
208 ApiQueryInfo
::$cachedTokens[ 'import' ] = $wgUser->getEditToken();
211 return ApiQueryInfo
::$cachedTokens[ 'import' ];
214 public static function getWatchToken( $pageid, $title ) {
216 if ( !$wgUser->isLoggedIn() ) {
220 // The token is always the same, let's exploit that
221 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'watch' ] ) ) {
222 ApiQueryInfo
::$cachedTokens[ 'watch' ] = $wgUser->getEditToken( 'watch' );
225 return ApiQueryInfo
::$cachedTokens[ 'watch' ];
228 public static function getOptionsToken( $pageid, $title ) {
230 if ( !$wgUser->isLoggedIn() ) {
234 // The token is always the same, let's exploit that
235 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'options' ] ) ) {
236 ApiQueryInfo
::$cachedTokens[ 'options' ] = $wgUser->getEditToken();
239 return ApiQueryInfo
::$cachedTokens[ 'options' ];
242 public function execute() {
243 $this->params
= $this->extractRequestParams();
244 if ( !is_null( $this->params
['prop'] ) ) {
245 $prop = array_flip( $this->params
['prop'] );
246 $this->fld_protection
= isset( $prop['protection'] );
247 $this->fld_watched
= isset( $prop['watched'] );
248 $this->fld_talkid
= isset( $prop['talkid'] );
249 $this->fld_subjectid
= isset( $prop['subjectid'] );
250 $this->fld_url
= isset( $prop['url'] );
251 $this->fld_readable
= isset( $prop['readable'] );
252 $this->fld_preload
= isset( $prop['preload'] );
253 $this->fld_displaytitle
= isset( $prop['displaytitle'] );
256 $pageSet = $this->getPageSet();
257 $this->titles
= $pageSet->getGoodTitles();
258 $this->missing
= $pageSet->getMissingTitles();
259 $this->everything
= $this->titles +
$this->missing
;
260 $result = $this->getResult();
262 uasort( $this->everything
, array( 'Title', 'compare' ) );
263 if ( !is_null( $this->params
['continue'] ) ) {
264 // Throw away any titles we're gonna skip so they don't
266 $cont = explode( '|', $this->params
['continue'] );
267 if ( count( $cont ) != 2 ) {
268 $this->dieUsage( 'Invalid continue param. You should pass the original ' .
269 'value returned by the previous query', '_badcontinue' );
271 $conttitle = Title
::makeTitleSafe( $cont[0], $cont[1] );
272 foreach ( $this->everything
as $pageid => $title ) {
273 if ( Title
::compare( $title, $conttitle ) >= 0 ) {
276 unset( $this->titles
[$pageid] );
277 unset( $this->missing
[$pageid] );
278 unset( $this->everything
[$pageid] );
282 $this->pageRestrictions
= $pageSet->getCustomField( 'page_restrictions' );
283 $this->pageIsRedir
= $pageSet->getCustomField( 'page_is_redirect' );
284 $this->pageIsNew
= $pageSet->getCustomField( 'page_is_new' );
286 global $wgDisableCounters;
288 if ( !$wgDisableCounters ) {
289 $this->pageCounter
= $pageSet->getCustomField( 'page_counter' );
291 $this->pageTouched
= $pageSet->getCustomField( 'page_touched' );
292 $this->pageLatest
= $pageSet->getCustomField( 'page_latest' );
293 $this->pageLength
= $pageSet->getCustomField( 'page_len' );
295 // Get protection info if requested
296 if ( $this->fld_protection
) {
297 $this->getProtectionInfo();
300 if ( $this->fld_watched
) {
301 $this->getWatchedInfo();
304 // Run the talkid/subjectid query if requested
305 if ( $this->fld_talkid ||
$this->fld_subjectid
) {
309 if ( $this->fld_displaytitle
) {
310 $this->getDisplayTitle();
313 foreach ( $this->everything
as $pageid => $title ) {
314 $pageInfo = $this->extractPageInfo( $pageid, $title );
315 $fit = $result->addValue( array(
318 ), $pageid, $pageInfo );
320 $this->setContinueEnumParameter( 'continue',
321 $title->getNamespace() . '|' .
329 * Get a result array with information about a title
330 * @param $pageid int Page ID (negative for missing titles)
331 * @param $title Title object
334 private function extractPageInfo( $pageid, $title ) {
336 $titleExists = $pageid > 0; //$title->exists() needs pageid, which is not set for all title objects
337 $ns = $title->getNamespace();
338 $dbkey = $title->getDBkey();
339 if ( $titleExists ) {
340 global $wgDisableCounters;
342 $pageInfo['touched'] = wfTimestamp( TS_ISO_8601
, $this->pageTouched
[$pageid] );
343 $pageInfo['lastrevid'] = intval( $this->pageLatest
[$pageid] );
344 $pageInfo['counter'] = $wgDisableCounters
346 : intval( $this->pageCounter
[$pageid] );
347 $pageInfo['length'] = intval( $this->pageLength
[$pageid] );
349 if ( $this->pageIsRedir
[$pageid] ) {
350 $pageInfo['redirect'] = '';
352 if ( $this->pageIsNew
[$pageid] ) {
353 $pageInfo['new'] = '';
357 if ( !is_null( $this->params
['token'] ) ) {
358 $tokenFunctions = $this->getTokenFunctions();
359 $pageInfo['starttimestamp'] = wfTimestamp( TS_ISO_8601
, time() );
360 foreach ( $this->params
['token'] as $t ) {
361 $val = call_user_func( $tokenFunctions[$t], $pageid, $title );
362 if ( $val === false ) {
363 $this->setWarning( "Action '$t' is not allowed for the current user" );
365 $pageInfo[$t . 'token'] = $val;
370 if ( $this->fld_protection
) {
371 $pageInfo['protection'] = array();
372 if ( isset( $this->protections
[$ns][$dbkey] ) ) {
373 $pageInfo['protection'] =
374 $this->protections
[$ns][$dbkey];
376 $this->getResult()->setIndexedTagName( $pageInfo['protection'], 'pr' );
379 if ( $this->fld_watched
&& isset( $this->watched
[$ns][$dbkey] ) ) {
380 $pageInfo['watched'] = '';
383 if ( $this->fld_talkid
&& isset( $this->talkids
[$ns][$dbkey] ) ) {
384 $pageInfo['talkid'] = $this->talkids
[$ns][$dbkey];
387 if ( $this->fld_subjectid
&& isset( $this->subjectids
[$ns][$dbkey] ) ) {
388 $pageInfo['subjectid'] = $this->subjectids
[$ns][$dbkey];
391 if ( $this->fld_url
) {
392 $pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT
);
393 $pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT
);
395 if ( $this->fld_readable
&& $title->userCan( 'read' ) ) {
396 $pageInfo['readable'] = '';
399 if ( $this->fld_preload
) {
400 if ( $titleExists ) {
401 $pageInfo['preload'] = '';
404 wfRunHooks( 'EditFormPreloadText', array( &$text, &$title ) );
406 $pageInfo['preload'] = $text;
410 if ( $this->fld_displaytitle
) {
411 if ( isset( $this->displaytitles
[$pageid] ) ) {
412 $pageInfo['displaytitle'] = $this->displaytitles
[$pageid];
414 $pageInfo['displaytitle'] = $title->getPrefixedText();
422 * Get information about protections and put it in $protections
424 private function getProtectionInfo() {
426 $this->protections
= array();
427 $db = $this->getDB();
429 // Get normal protections for existing titles
430 if ( count( $this->titles
) ) {
431 $this->resetQueryParams();
432 $this->addTables( array( 'page_restrictions', 'page' ) );
433 $this->addWhere( 'page_id=pr_page' );
434 $this->addFields( array( 'pr_page', 'pr_type', 'pr_level',
435 'pr_expiry', 'pr_cascade', 'page_namespace',
437 $this->addWhereFld( 'pr_page', array_keys( $this->titles
) );
439 $res = $this->select( __METHOD__
);
440 foreach ( $res as $row ) {
442 'type' => $row->pr_type
,
443 'level' => $row->pr_level
,
444 'expiry' => $wgContLang->formatExpiry( $row->pr_expiry
, TS_ISO_8601
)
446 if ( $row->pr_cascade
) {
449 $this->protections
[$row->page_namespace
][$row->page_title
][] = $a;
451 // Also check old restrictions
452 if ( $this->pageRestrictions
[$row->pr_page
] ) {
453 $restrictions = explode( ':', trim( $this->pageRestrictions
[$row->pr_page
] ) );
454 foreach ( $restrictions as $restrict ) {
455 $temp = explode( '=', trim( $restrict ) );
456 if ( count( $temp ) == 1 ) {
457 // old old format should be treated as edit/move restriction
458 $restriction = trim( $temp[0] );
460 if ( $restriction == '' ) {
463 $this->protections
[$row->page_namespace
][$row->page_title
][] = array(
465 'level' => $restriction,
466 'expiry' => 'infinity',
468 $this->protections
[$row->page_namespace
][$row->page_title
][] = array(
470 'level' => $restriction,
471 'expiry' => 'infinity',
474 $restriction = trim( $temp[1] );
475 if ( $restriction == '' ) {
478 $this->protections
[$row->page_namespace
][$row->page_title
][] = array(
480 'level' => $restriction,
481 'expiry' => 'infinity',
489 // Get protections for missing titles
490 if ( count( $this->missing
) ) {
491 $this->resetQueryParams();
492 $lb = new LinkBatch( $this->missing
);
493 $this->addTables( 'protected_titles' );
494 $this->addFields( array( 'pt_title', 'pt_namespace', 'pt_create_perm', 'pt_expiry' ) );
495 $this->addWhere( $lb->constructSet( 'pt', $db ) );
496 $res = $this->select( __METHOD__
);
497 foreach ( $res as $row ) {
498 $this->protections
[$row->pt_namespace
][$row->pt_title
][] = array(
500 'level' => $row->pt_create_perm
,
501 'expiry' => $wgContLang->formatExpiry( $row->pt_expiry
, TS_ISO_8601
)
506 // Cascading protections
507 $images = $others = array();
508 foreach ( $this->everything
as $title ) {
509 if ( $title->getNamespace() == NS_FILE
) {
510 $images[] = $title->getDBkey();
516 if ( count( $others ) ) {
517 // Non-images: check templatelinks
518 $lb = new LinkBatch( $others );
519 $this->resetQueryParams();
520 $this->addTables( array( 'page_restrictions', 'page', 'templatelinks' ) );
521 $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
522 'page_title', 'page_namespace',
523 'tl_title', 'tl_namespace' ) );
524 $this->addWhere( $lb->constructSet( 'tl', $db ) );
525 $this->addWhere( 'pr_page = page_id' );
526 $this->addWhere( 'pr_page = tl_from' );
527 $this->addWhereFld( 'pr_cascade', 1 );
529 $res = $this->select( __METHOD__
);
530 foreach ( $res as $row ) {
531 $source = Title
::makeTitle( $row->page_namespace
, $row->page_title
);
532 $this->protections
[$row->tl_namespace
][$row->tl_title
][] = array(
533 'type' => $row->pr_type
,
534 'level' => $row->pr_level
,
535 'expiry' => $wgContLang->formatExpiry( $row->pr_expiry
, TS_ISO_8601
),
536 'source' => $source->getPrefixedText()
541 if ( count( $images ) ) {
542 // Images: check imagelinks
543 $this->resetQueryParams();
544 $this->addTables( array( 'page_restrictions', 'page', 'imagelinks' ) );
545 $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
546 'page_title', 'page_namespace', 'il_to' ) );
547 $this->addWhere( 'pr_page = page_id' );
548 $this->addWhere( 'pr_page = il_from' );
549 $this->addWhereFld( 'pr_cascade', 1 );
550 $this->addWhereFld( 'il_to', $images );
552 $res = $this->select( __METHOD__
);
553 foreach ( $res as $row ) {
554 $source = Title
::makeTitle( $row->page_namespace
, $row->page_title
);
555 $this->protections
[NS_FILE
][$row->il_to
][] = array(
556 'type' => $row->pr_type
,
557 'level' => $row->pr_level
,
558 'expiry' => $wgContLang->formatExpiry( $row->pr_expiry
, TS_ISO_8601
),
559 'source' => $source->getPrefixedText()
566 * Get talk page IDs (if requested) and subject page IDs (if requested)
567 * and put them in $talkids and $subjectids
569 private function getTSIDs() {
570 $getTitles = $this->talkids
= $this->subjectids
= array();
572 foreach ( $this->everything
as $t ) {
573 if ( MWNamespace
::isTalk( $t->getNamespace() ) ) {
574 if ( $this->fld_subjectid
) {
575 $getTitles[] = $t->getSubjectPage();
577 } elseif ( $this->fld_talkid
) {
578 $getTitles[] = $t->getTalkPage();
581 if ( !count( $getTitles ) ) {
585 $db = $this->getDB();
587 // Construct a custom WHERE clause that matches
588 // all titles in $getTitles
589 $lb = new LinkBatch( $getTitles );
590 $this->resetQueryParams();
591 $this->addTables( 'page' );
592 $this->addFields( array( 'page_title', 'page_namespace', 'page_id' ) );
593 $this->addWhere( $lb->constructSet( 'page', $db ) );
594 $res = $this->select( __METHOD__
);
595 foreach ( $res as $row ) {
596 if ( MWNamespace
::isTalk( $row->page_namespace
) ) {
597 $this->talkids
[MWNamespace
::getSubject( $row->page_namespace
)][$row->page_title
] =
598 intval( $row->page_id
);
600 $this->subjectids
[MWNamespace
::getTalk( $row->page_namespace
)][$row->page_title
] =
601 intval( $row->page_id
);
606 private function getDisplayTitle() {
607 $this->displaytitles
= array();
609 $pageIds = array_keys( $this->titles
);
611 if ( !count( $pageIds ) ) {
615 $this->resetQueryParams();
616 $this->addTables( 'page_props' );
617 $this->addFields( array( 'pp_page', 'pp_value' ) );
618 $this->addWhereFld( 'pp_page', $pageIds );
619 $this->addWhereFld( 'pp_propname', 'displaytitle' );
620 $res = $this->select( __METHOD__
);
622 foreach ( $res as $row ) {
623 $this->displaytitles
[$row->pp_page
] = $row->pp_value
;
628 * Get information about watched status and put it in $this->watched
630 private function getWatchedInfo() {
631 $user = $this->getUser();
633 if ( $user->isAnon() ||
count( $this->everything
) == 0 ) {
637 $this->watched
= array();
638 $db = $this->getDB();
640 $lb = new LinkBatch( $this->everything
);
642 $this->resetQueryParams();
643 $this->addTables( array( 'watchlist' ) );
644 $this->addFields( array( 'wl_title', 'wl_namespace' ) );
645 $this->addWhere( array(
646 $lb->constructSet( 'wl', $db ),
647 'wl_user' => $user->getID()
650 $res = $this->select( __METHOD__
);
652 foreach ( $res as $row ) {
653 $this->watched
[$row->wl_namespace
][$row->wl_title
] = true;
657 public function getCacheMode( $params ) {
658 $publicProps = array(
666 if ( !is_null( $params['prop'] ) ) {
667 foreach ( $params['prop'] as $prop ) {
668 if ( !in_array( $prop, $publicProps ) ) {
673 if ( !is_null( $params['token'] ) ) {
679 public function getAllowedParams() {
682 ApiBase
::PARAM_DFLT
=> null,
683 ApiBase
::PARAM_ISMULTI
=> true,
684 ApiBase
::PARAM_TYPE
=> array(
690 'readable', # private
693 // If you add more properties here, please consider whether they
694 // need to be added to getCacheMode()
697 ApiBase
::PARAM_DFLT
=> null,
698 ApiBase
::PARAM_ISMULTI
=> true,
699 ApiBase
::PARAM_TYPE
=> array_keys( $this->getTokenFunctions() )
705 public function getParamDescription() {
708 'Which additional properties to get:',
709 ' protection - List the protection level of each page',
710 ' talkid - The page ID of the talk page for each non-talk page',
711 ' watched - List the watched status of each page',
712 ' subjectid - The page ID of the parent page for each talk page',
713 ' url - Gives a full URL to the page, and also an edit URL',
714 ' readable - Whether the user can read this page',
715 ' preload - Gives the text returned by EditFormPreloadText',
716 ' displaytitle - Gives the way the page title is actually displayed',
718 'token' => 'Request a token to perform a data-modifying action on a page',
719 'continue' => 'When more results are available, use this to continue',
723 public function getResultProperties() {
725 ApiBase
::PROP_LIST
=> false,
727 'touched' => 'timestamp',
728 'lastrevid' => 'integer',
730 ApiBase
::PROP_TYPE
=> 'integer',
731 ApiBase
::PROP_NULLABLE
=> true
733 'length' => 'integer',
734 'redirect' => 'boolean',
736 'starttimestamp' => array(
737 ApiBase
::PROP_TYPE
=> 'timestamp',
738 ApiBase
::PROP_NULLABLE
=> true
742 'watched' => 'boolean'
746 ApiBase
::PROP_TYPE
=> 'integer',
747 ApiBase
::PROP_NULLABLE
=> true
750 'subjectid' => array(
751 'subjectid' => array(
752 ApiBase
::PROP_TYPE
=> 'integer',
753 ApiBase
::PROP_NULLABLE
=> true
757 'fullurl' => 'string',
758 'editurl' => 'string'
761 'readable' => 'boolean'
764 'preload' => 'string'
766 'displaytitle' => array(
767 'displaytitle' => 'string'
771 self
::addTokenProperties( $props, $this->getTokenFunctions() );
776 public function getDescription() {
777 return 'Get basic page information such as namespace, title, last touched date, ...';
780 public function getPossibleErrors() {
781 return array_merge( parent
::getPossibleErrors(), array(
782 array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
786 public function getExamples() {
788 'api.php?action=query&prop=info&titles=Main%20Page',
789 'api.php?action=query&prop=info&inprop=protection&titles=Main%20Page'
793 public function getHelpUrls() {
794 return 'https://www.mediawiki.org/wiki/API:Properties#info_.2F_in';
797 public function getVersion() {
798 return __CLASS__
. ': $Id$';