From 69c42aadaa7de3cd6c5836e2ff0dce148890b74d Mon Sep 17 00:00:00 2001 From: umherirrender Date: Wed, 8 May 2013 20:08:40 +0200 Subject: [PATCH] Add content model to prop=info Fields of page table are shown by default in prop=info Change-Id: Id8b90c341dea19337558ed355975ab890f0663e2 --- RELEASE-NOTES-1.22 | 1 + includes/api/ApiQueryInfo.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index d13c825189..fdff848844 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -108,6 +108,7 @@ production. stored in the database. * (bug 47219) Allow specifying change type of Wikipedia feed items * prop=imageinfo now allows setting iiurlheight without setting iiurlwidth +* prop=info now adds the content model of the title. === Languages updated in 1.22=== diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 6dbda5fb09..787057d128 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -56,7 +56,7 @@ class ApiQueryInfo extends ApiQueryBase { * @return void */ public function requestExtraData( $pageSet ) { - global $wgDisableCounters; + global $wgDisableCounters, $wgContentHandlerUseDB; $pageSet->requestField( 'page_restrictions' ); // when resolving redirects, no page will have this field @@ -70,6 +70,9 @@ class ApiQueryInfo extends ApiQueryBase { $pageSet->requestField( 'page_touched' ); $pageSet->requestField( 'page_latest' ); $pageSet->requestField( 'page_len' ); + if ( $wgContentHandlerUseDB ) { + $pageSet->requestField( 'page_content_model' ); + } } /** @@ -348,6 +351,9 @@ class ApiQueryInfo extends ApiQueryBase { $titleExists = $pageid > 0; //$title->exists() needs pageid, which is not set for all title objects $ns = $title->getNamespace(); $dbkey = $title->getDBkey(); + + $pageInfo['contentmodel'] = $title->getContentModel(); + if ( $titleExists ) { global $wgDisableCounters; @@ -819,7 +825,8 @@ class ApiQueryInfo extends ApiQueryBase { 'starttimestamp' => array( ApiBase::PROP_TYPE => 'timestamp', ApiBase::PROP_NULLABLE => true - ) + ), + 'contentmodel' => 'string', ), 'watched' => array( 'watched' => 'boolean' -- 2.20.1