Merge "Allow setting the ID of the main table in HTMLForm"
[lhc/web/wiklou.git] / includes / api / ApiQueryInfo.php
index 6dbda5f..5f8c497 100644 (file)
@@ -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,10 @@ 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();
+               $pageInfo['pagelanguage'] = $title->getPageLanguage()->getCode();
+
                if ( $titleExists ) {
                        global $wgDisableCounters;
 
@@ -819,7 +826,8 @@ class ApiQueryInfo extends ApiQueryBase {
                                'starttimestamp' => array(
                                        ApiBase::PROP_TYPE => 'timestamp',
                                        ApiBase::PROP_NULLABLE => true
-                               )
+                               ),
+                               'contentmodel' => 'string',
                        ),
                        'watched' => array(
                                'watched' => 'boolean'