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 // when resolving redirects, no page will have this field
61 if( !$pageSet->isResolvingRedirects() ) {
62 $pageSet->requestField( 'page_is_redirect' );
64 $pageSet->requestField( 'page_is_new' );
65 if ( !$wgDisableCounters ) {
66 $pageSet->requestField( 'page_counter' );
68 $pageSet->requestField( 'page_touched' );
69 $pageSet->requestField( 'page_latest' );
70 $pageSet->requestField( 'page_len' );
74 * Get an array mapping token names to their handler functions.
75 * The prototype for a token function is func($pageid, $title)
76 * it should return a token or false (permission denied)
77 * @return array array(tokenname => function)
79 protected function getTokenFunctions() {
80 // Don't call the hooks twice
81 if ( isset( $this->tokenFunctions
) ) {
82 return $this->tokenFunctions
;
85 // If we're in JSON callback mode, no tokens can be obtained
86 if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
90 $this->tokenFunctions
= array(
91 'edit' => array( 'ApiQueryInfo', 'getEditToken' ),
92 'delete' => array( 'ApiQueryInfo', 'getDeleteToken' ),
93 'protect' => array( 'ApiQueryInfo', 'getProtectToken' ),
94 'move' => array( 'ApiQueryInfo', 'getMoveToken' ),
95 'block' => array( 'ApiQueryInfo', 'getBlockToken' ),
96 'unblock' => array( 'ApiQueryInfo', 'getUnblockToken' ),
97 'email' => array( 'ApiQueryInfo', 'getEmailToken' ),
98 'import' => array( 'ApiQueryInfo', 'getImportToken' ),
99 'watch' => array( 'ApiQueryInfo', 'getWatchToken'),
101 wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions
) );
102 return $this->tokenFunctions
;
105 static $cachedTokens = array();
107 public static function resetTokenCache() {
108 ApiQueryInfo
::$cachedTokens = array();
111 public static function getEditToken( $pageid, $title ) {
112 // We could check for $title->userCan('edit') here,
113 // but that's too expensive for this purpose
114 // and would break caching
116 if ( !$wgUser->isAllowed( 'edit' ) ) {
120 // The token is always the same, let's exploit that
121 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'edit' ] ) ) {
122 ApiQueryInfo
::$cachedTokens[ 'edit' ] = $wgUser->getEditToken();
125 return ApiQueryInfo
::$cachedTokens[ 'edit' ];
128 public static function getDeleteToken( $pageid, $title ) {
130 if ( !$wgUser->isAllowed( 'delete' ) ) {
134 // The token is always the same, let's exploit that
135 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'delete' ] ) ) {
136 ApiQueryInfo
::$cachedTokens[ 'delete' ] = $wgUser->getEditToken();
139 return ApiQueryInfo
::$cachedTokens[ 'delete' ];
142 public static function getProtectToken( $pageid, $title ) {
144 if ( !$wgUser->isAllowed( 'protect' ) ) {
148 // The token is always the same, let's exploit that
149 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'protect' ] ) ) {
150 ApiQueryInfo
::$cachedTokens[ 'protect' ] = $wgUser->getEditToken();
153 return ApiQueryInfo
::$cachedTokens[ 'protect' ];
156 public static function getMoveToken( $pageid, $title ) {
158 if ( !$wgUser->isAllowed( 'move' ) ) {
162 // The token is always the same, let's exploit that
163 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'move' ] ) ) {
164 ApiQueryInfo
::$cachedTokens[ 'move' ] = $wgUser->getEditToken();
167 return ApiQueryInfo
::$cachedTokens[ 'move' ];
170 public static function getBlockToken( $pageid, $title ) {
172 if ( !$wgUser->isAllowed( 'block' ) ) {
176 // The token is always the same, let's exploit that
177 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'block' ] ) ) {
178 ApiQueryInfo
::$cachedTokens[ 'block' ] = $wgUser->getEditToken();
181 return ApiQueryInfo
::$cachedTokens[ 'block' ];
184 public static function getUnblockToken( $pageid, $title ) {
185 // Currently, this is exactly the same as the block token
186 return self
::getBlockToken( $pageid, $title );
189 public static function getEmailToken( $pageid, $title ) {
191 if ( !$wgUser->canSendEmail() ||
$wgUser->isBlockedFromEmailUser() ) {
195 // The token is always the same, let's exploit that
196 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'email' ] ) ) {
197 ApiQueryInfo
::$cachedTokens[ 'email' ] = $wgUser->getEditToken();
200 return ApiQueryInfo
::$cachedTokens[ 'email' ];
203 public static function getImportToken( $pageid, $title ) {
205 if ( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) {
209 // The token is always the same, let's exploit that
210 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'import' ] ) ) {
211 ApiQueryInfo
::$cachedTokens[ 'import' ] = $wgUser->getEditToken();
214 return ApiQueryInfo
::$cachedTokens[ 'import' ];
217 public static function getWatchToken( $pageid, $title ) {
219 if ( !$wgUser->isLoggedIn() ) {
223 // The token is always the same, let's exploit that
224 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'watch' ] ) ) {
225 ApiQueryInfo
::$cachedTokens[ 'watch' ] = $wgUser->getEditToken( 'watch' );
228 return ApiQueryInfo
::$cachedTokens[ 'watch' ];
231 public static function getOptionsToken( $pageid, $title ) {
233 if ( !$wgUser->isLoggedIn() ) {
237 // The token is always the same, let's exploit that
238 if ( !isset( ApiQueryInfo
::$cachedTokens[ 'options' ] ) ) {
239 ApiQueryInfo
::$cachedTokens[ 'options' ] = $wgUser->getEditToken();
242 return ApiQueryInfo
::$cachedTokens[ 'options' ];
245 public function execute() {
246 $this->params
= $this->extractRequestParams();
247 if ( !is_null( $this->params
['prop'] ) ) {
248 $prop = array_flip( $this->params
['prop'] );
249 $this->fld_protection
= isset( $prop['protection'] );
250 $this->fld_watched
= isset( $prop['watched'] );
251 $this->fld_talkid
= isset( $prop['talkid'] );
252 $this->fld_subjectid
= isset( $prop['subjectid'] );
253 $this->fld_url
= isset( $prop['url'] );
254 $this->fld_readable
= isset( $prop['readable'] );
255 $this->fld_preload
= isset( $prop['preload'] );
256 $this->fld_displaytitle
= isset( $prop['displaytitle'] );
259 $pageSet = $this->getPageSet();
260 $this->titles
= $pageSet->getGoodTitles();
261 $this->missing
= $pageSet->getMissingTitles();
262 $this->everything
= $this->titles +
$this->missing
;
263 $result = $this->getResult();
265 uasort( $this->everything
, array( 'Title', 'compare' ) );
266 if ( !is_null( $this->params
['continue'] ) ) {
267 // Throw away any titles we're gonna skip so they don't
269 $cont = explode( '|', $this->params
['continue'] );
270 if ( count( $cont ) != 2 ) {
271 $this->dieUsage( 'Invalid continue param. You should pass the original ' .
272 'value returned by the previous query', '_badcontinue' );
274 $conttitle = Title
::makeTitleSafe( $cont[0], $cont[1] );
275 foreach ( $this->everything
as $pageid => $title ) {
276 if ( Title
::compare( $title, $conttitle ) >= 0 ) {
279 unset( $this->titles
[$pageid] );
280 unset( $this->missing
[$pageid] );
281 unset( $this->everything
[$pageid] );
285 $this->pageRestrictions
= $pageSet->getCustomField( 'page_restrictions' );
286 // when resolving redirects, no page will have this field
287 $this->pageIsRedir
= !$pageSet->isResolvingRedirects()
288 ?
$pageSet->getCustomField( 'page_is_redirect' )
290 $this->pageIsNew
= $pageSet->getCustomField( 'page_is_new' );
292 global $wgDisableCounters;
294 if ( !$wgDisableCounters ) {
295 $this->pageCounter
= $pageSet->getCustomField( 'page_counter' );
297 $this->pageTouched
= $pageSet->getCustomField( 'page_touched' );
298 $this->pageLatest
= $pageSet->getCustomField( 'page_latest' );
299 $this->pageLength
= $pageSet->getCustomField( 'page_len' );
301 // Get protection info if requested
302 if ( $this->fld_protection
) {
303 $this->getProtectionInfo();
306 if ( $this->fld_watched
) {
307 $this->getWatchedInfo();
310 // Run the talkid/subjectid query if requested
311 if ( $this->fld_talkid ||
$this->fld_subjectid
) {
315 if ( $this->fld_displaytitle
) {
316 $this->getDisplayTitle();
319 foreach ( $this->everything
as $pageid => $title ) {
320 $pageInfo = $this->extractPageInfo( $pageid, $title );
321 $fit = $result->addValue( array(
324 ), $pageid, $pageInfo );
326 $this->setContinueEnumParameter( 'continue',
327 $title->getNamespace() . '|' .
335 * Get a result array with information about a title
336 * @param $pageid int Page ID (negative for missing titles)
337 * @param $title Title object
340 private function extractPageInfo( $pageid, $title ) {
342 $titleExists = $pageid > 0; //$title->exists() needs pageid, which is not set for all title objects
343 $ns = $title->getNamespace();
344 $dbkey = $title->getDBkey();
345 if ( $titleExists ) {
346 global $wgDisableCounters;
348 $pageInfo['touched'] = wfTimestamp( TS_ISO_8601
, $this->pageTouched
[$pageid] );
349 $pageInfo['lastrevid'] = intval( $this->pageLatest
[$pageid] );
350 $pageInfo['counter'] = $wgDisableCounters
352 : intval( $this->pageCounter
[$pageid] );
353 $pageInfo['length'] = intval( $this->pageLength
[$pageid] );
355 if ( isset( $this->pageIsRedir
[$pageid] ) && $this->pageIsRedir
[$pageid] ) {
356 $pageInfo['redirect'] = '';
358 if ( $this->pageIsNew
[$pageid] ) {
359 $pageInfo['new'] = '';
363 if ( !is_null( $this->params
['token'] ) ) {
364 $tokenFunctions = $this->getTokenFunctions();
365 $pageInfo['starttimestamp'] = wfTimestamp( TS_ISO_8601
, time() );
366 foreach ( $this->params
['token'] as $t ) {
367 $val = call_user_func( $tokenFunctions[$t], $pageid, $title );
368 if ( $val === false ) {
369 $this->setWarning( "Action '$t' is not allowed for the current user" );
371 $pageInfo[$t . 'token'] = $val;
376 if ( $this->fld_protection
) {
377 $pageInfo['protection'] = array();
378 if ( isset( $this->protections
[$ns][$dbkey] ) ) {
379 $pageInfo['protection'] =
380 $this->protections
[$ns][$dbkey];
382 $this->getResult()->setIndexedTagName( $pageInfo['protection'], 'pr' );
385 if ( $this->fld_watched
&& isset( $this->watched
[$ns][$dbkey] ) ) {
386 $pageInfo['watched'] = '';
389 if ( $this->fld_talkid
&& isset( $this->talkids
[$ns][$dbkey] ) ) {
390 $pageInfo['talkid'] = $this->talkids
[$ns][$dbkey];
393 if ( $this->fld_subjectid
&& isset( $this->subjectids
[$ns][$dbkey] ) ) {
394 $pageInfo['subjectid'] = $this->subjectids
[$ns][$dbkey];
397 if ( $this->fld_url
) {
398 $pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT
);
399 $pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT
);
401 if ( $this->fld_readable
&& $title->userCan( 'read' ) ) {
402 $pageInfo['readable'] = '';
405 if ( $this->fld_preload
) {
406 if ( $titleExists ) {
407 $pageInfo['preload'] = '';
410 wfRunHooks( 'EditFormPreloadText', array( &$text, &$title ) );
412 $pageInfo['preload'] = $text;
416 if ( $this->fld_displaytitle
) {
417 if ( isset( $this->displaytitles
[$pageid] ) ) {
418 $pageInfo['displaytitle'] = $this->displaytitles
[$pageid];
420 $pageInfo['displaytitle'] = $title->getPrefixedText();
428 * Get information about protections and put it in $protections
430 private function getProtectionInfo() {
432 $this->protections
= array();
433 $db = $this->getDB();
435 // Get normal protections for existing titles
436 if ( count( $this->titles
) ) {
437 $this->resetQueryParams();
438 $this->addTables( array( 'page_restrictions', 'page' ) );
439 $this->addWhere( 'page_id=pr_page' );
440 $this->addFields( array( 'pr_page', 'pr_type', 'pr_level',
441 'pr_expiry', 'pr_cascade', 'page_namespace',
443 $this->addWhereFld( 'pr_page', array_keys( $this->titles
) );
445 $res = $this->select( __METHOD__
);
446 foreach ( $res as $row ) {
448 'type' => $row->pr_type
,
449 'level' => $row->pr_level
,
450 'expiry' => $wgContLang->formatExpiry( $row->pr_expiry
, TS_ISO_8601
)
452 if ( $row->pr_cascade
) {
455 $this->protections
[$row->page_namespace
][$row->page_title
][] = $a;
457 // Also check old restrictions
458 if ( $this->pageRestrictions
[$row->pr_page
] ) {
459 $restrictions = explode( ':', trim( $this->pageRestrictions
[$row->pr_page
] ) );
460 foreach ( $restrictions as $restrict ) {
461 $temp = explode( '=', trim( $restrict ) );
462 if ( count( $temp ) == 1 ) {
463 // old old format should be treated as edit/move restriction
464 $restriction = trim( $temp[0] );
466 if ( $restriction == '' ) {
469 $this->protections
[$row->page_namespace
][$row->page_title
][] = array(
471 'level' => $restriction,
472 'expiry' => 'infinity',
474 $this->protections
[$row->page_namespace
][$row->page_title
][] = array(
476 'level' => $restriction,
477 'expiry' => 'infinity',
480 $restriction = trim( $temp[1] );
481 if ( $restriction == '' ) {
484 $this->protections
[$row->page_namespace
][$row->page_title
][] = array(
486 'level' => $restriction,
487 'expiry' => 'infinity',
495 // Get protections for missing titles
496 if ( count( $this->missing
) ) {
497 $this->resetQueryParams();
498 $lb = new LinkBatch( $this->missing
);
499 $this->addTables( 'protected_titles' );
500 $this->addFields( array( 'pt_title', 'pt_namespace', 'pt_create_perm', 'pt_expiry' ) );
501 $this->addWhere( $lb->constructSet( 'pt', $db ) );
502 $res = $this->select( __METHOD__
);
503 foreach ( $res as $row ) {
504 $this->protections
[$row->pt_namespace
][$row->pt_title
][] = array(
506 'level' => $row->pt_create_perm
,
507 'expiry' => $wgContLang->formatExpiry( $row->pt_expiry
, TS_ISO_8601
)
512 // Cascading protections
513 $images = $others = array();
514 foreach ( $this->everything
as $title ) {
515 if ( $title->getNamespace() == NS_FILE
) {
516 $images[] = $title->getDBkey();
522 if ( count( $others ) ) {
523 // Non-images: check templatelinks
524 $lb = new LinkBatch( $others );
525 $this->resetQueryParams();
526 $this->addTables( array( 'page_restrictions', 'page', 'templatelinks' ) );
527 $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
528 'page_title', 'page_namespace',
529 'tl_title', 'tl_namespace' ) );
530 $this->addWhere( $lb->constructSet( 'tl', $db ) );
531 $this->addWhere( 'pr_page = page_id' );
532 $this->addWhere( 'pr_page = tl_from' );
533 $this->addWhereFld( 'pr_cascade', 1 );
535 $res = $this->select( __METHOD__
);
536 foreach ( $res as $row ) {
537 $source = Title
::makeTitle( $row->page_namespace
, $row->page_title
);
538 $this->protections
[$row->tl_namespace
][$row->tl_title
][] = array(
539 'type' => $row->pr_type
,
540 'level' => $row->pr_level
,
541 'expiry' => $wgContLang->formatExpiry( $row->pr_expiry
, TS_ISO_8601
),
542 'source' => $source->getPrefixedText()
547 if ( count( $images ) ) {
548 // Images: check imagelinks
549 $this->resetQueryParams();
550 $this->addTables( array( 'page_restrictions', 'page', 'imagelinks' ) );
551 $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
552 'page_title', 'page_namespace', 'il_to' ) );
553 $this->addWhere( 'pr_page = page_id' );
554 $this->addWhere( 'pr_page = il_from' );
555 $this->addWhereFld( 'pr_cascade', 1 );
556 $this->addWhereFld( 'il_to', $images );
558 $res = $this->select( __METHOD__
);
559 foreach ( $res as $row ) {
560 $source = Title
::makeTitle( $row->page_namespace
, $row->page_title
);
561 $this->protections
[NS_FILE
][$row->il_to
][] = array(
562 'type' => $row->pr_type
,
563 'level' => $row->pr_level
,
564 'expiry' => $wgContLang->formatExpiry( $row->pr_expiry
, TS_ISO_8601
),
565 'source' => $source->getPrefixedText()
572 * Get talk page IDs (if requested) and subject page IDs (if requested)
573 * and put them in $talkids and $subjectids
575 private function getTSIDs() {
576 $getTitles = $this->talkids
= $this->subjectids
= array();
578 foreach ( $this->everything
as $t ) {
579 if ( MWNamespace
::isTalk( $t->getNamespace() ) ) {
580 if ( $this->fld_subjectid
) {
581 $getTitles[] = $t->getSubjectPage();
583 } elseif ( $this->fld_talkid
) {
584 $getTitles[] = $t->getTalkPage();
587 if ( !count( $getTitles ) ) {
591 $db = $this->getDB();
593 // Construct a custom WHERE clause that matches
594 // all titles in $getTitles
595 $lb = new LinkBatch( $getTitles );
596 $this->resetQueryParams();
597 $this->addTables( 'page' );
598 $this->addFields( array( 'page_title', 'page_namespace', 'page_id' ) );
599 $this->addWhere( $lb->constructSet( 'page', $db ) );
600 $res = $this->select( __METHOD__
);
601 foreach ( $res as $row ) {
602 if ( MWNamespace
::isTalk( $row->page_namespace
) ) {
603 $this->talkids
[MWNamespace
::getSubject( $row->page_namespace
)][$row->page_title
] =
604 intval( $row->page_id
);
606 $this->subjectids
[MWNamespace
::getTalk( $row->page_namespace
)][$row->page_title
] =
607 intval( $row->page_id
);
612 private function getDisplayTitle() {
613 $this->displaytitles
= array();
615 $pageIds = array_keys( $this->titles
);
617 if ( !count( $pageIds ) ) {
621 $this->resetQueryParams();
622 $this->addTables( 'page_props' );
623 $this->addFields( array( 'pp_page', 'pp_value' ) );
624 $this->addWhereFld( 'pp_page', $pageIds );
625 $this->addWhereFld( 'pp_propname', 'displaytitle' );
626 $res = $this->select( __METHOD__
);
628 foreach ( $res as $row ) {
629 $this->displaytitles
[$row->pp_page
] = $row->pp_value
;
634 * Get information about watched status and put it in $this->watched
636 private function getWatchedInfo() {
637 $user = $this->getUser();
639 if ( $user->isAnon() ||
count( $this->everything
) == 0 ) {
643 $this->watched
= array();
644 $db = $this->getDB();
646 $lb = new LinkBatch( $this->everything
);
648 $this->resetQueryParams();
649 $this->addTables( array( 'watchlist' ) );
650 $this->addFields( array( 'wl_title', 'wl_namespace' ) );
651 $this->addWhere( array(
652 $lb->constructSet( 'wl', $db ),
653 'wl_user' => $user->getID()
656 $res = $this->select( __METHOD__
);
658 foreach ( $res as $row ) {
659 $this->watched
[$row->wl_namespace
][$row->wl_title
] = true;
663 public function getCacheMode( $params ) {
664 $publicProps = array(
672 if ( !is_null( $params['prop'] ) ) {
673 foreach ( $params['prop'] as $prop ) {
674 if ( !in_array( $prop, $publicProps ) ) {
679 if ( !is_null( $params['token'] ) ) {
685 public function getAllowedParams() {
688 ApiBase
::PARAM_DFLT
=> null,
689 ApiBase
::PARAM_ISMULTI
=> true,
690 ApiBase
::PARAM_TYPE
=> array(
696 'readable', # private
699 // If you add more properties here, please consider whether they
700 // need to be added to getCacheMode()
703 ApiBase
::PARAM_DFLT
=> null,
704 ApiBase
::PARAM_ISMULTI
=> true,
705 ApiBase
::PARAM_TYPE
=> array_keys( $this->getTokenFunctions() )
711 public function getParamDescription() {
714 'Which additional properties to get:',
715 ' protection - List the protection level of each page',
716 ' talkid - The page ID of the talk page for each non-talk page',
717 ' watched - List the watched status of each page',
718 ' subjectid - The page ID of the parent page for each talk page',
719 ' url - Gives a full URL to the page, and also an edit URL',
720 ' readable - Whether the user can read this page',
721 ' preload - Gives the text returned by EditFormPreloadText',
722 ' displaytitle - Gives the way the page title is actually displayed',
724 'token' => 'Request a token to perform a data-modifying action on a page',
725 'continue' => 'When more results are available, use this to continue',
729 public function getResultProperties() {
731 ApiBase
::PROP_LIST
=> false,
733 'touched' => 'timestamp',
734 'lastrevid' => 'integer',
736 ApiBase
::PROP_TYPE
=> 'integer',
737 ApiBase
::PROP_NULLABLE
=> true
739 'length' => 'integer',
740 'redirect' => 'boolean',
742 'starttimestamp' => array(
743 ApiBase
::PROP_TYPE
=> 'timestamp',
744 ApiBase
::PROP_NULLABLE
=> true
748 'watched' => 'boolean'
752 ApiBase
::PROP_TYPE
=> 'integer',
753 ApiBase
::PROP_NULLABLE
=> true
756 'subjectid' => array(
757 'subjectid' => array(
758 ApiBase
::PROP_TYPE
=> 'integer',
759 ApiBase
::PROP_NULLABLE
=> true
763 'fullurl' => 'string',
764 'editurl' => 'string'
767 'readable' => 'boolean'
770 'preload' => 'string'
772 'displaytitle' => array(
773 'displaytitle' => 'string'
777 self
::addTokenProperties( $props, $this->getTokenFunctions() );
782 public function getDescription() {
783 return 'Get basic page information such as namespace, title, last touched date, ...';
786 public function getPossibleErrors() {
787 return array_merge( parent
::getPossibleErrors(), array(
788 array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
792 public function getExamples() {
794 'api.php?action=query&prop=info&titles=Main%20Page',
795 'api.php?action=query&prop=info&inprop=protection&titles=Main%20Page'
799 public function getHelpUrls() {
800 return 'https://www.mediawiki.org/wiki/API:Properties#info_.2F_in';
803 public function getVersion() {
804 return __CLASS__
. ': $Id$';