X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryInfo.php;h=5f8c49784af13075f23ccc2fed3a4427b78c3292;hb=8a839c89a35187cccf5cfded568fc2007e7a3389;hp=a888d997f22c8e491230c61256a4e1b39ff0c0af;hpb=83d509123c35196df82e01824ded68ef6fbf0cee;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index a888d997f2..5f8c49784a 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -56,11 +56,11 @@ 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 - if( !$pageSet->isResolvingRedirects() ) { + if ( !$pageSet->isResolvingRedirects() ) { $pageSet->requestField( 'page_is_redirect' ); } $pageSet->requestField( 'page_is_new' ); @@ -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' ); + } } /** @@ -321,6 +324,7 @@ class ApiQueryInfo extends ApiQueryBase { $this->getDisplayTitle(); } + /** @var $title Title */ foreach ( $this->everything as $pageid => $title ) { $pageInfo = $this->extractPageInfo( $pageid, $title ); $fit = $result->addValue( array( @@ -338,7 +342,7 @@ class ApiQueryInfo extends ApiQueryBase { /** * Get a result array with information about a title - * @param $pageid int Page ID (negative for missing titles) + * @param int $pageid Page ID (negative for missing titles) * @param $title Title object * @return array */ @@ -347,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; @@ -462,6 +470,7 @@ class ApiQueryInfo extends ApiQueryBase { $res = $this->select( __METHOD__ ); foreach ( $res as $row ) { + /** @var $title Title */ $title = $this->titles[$row->pr_page]; $a = array( 'type' => $row->pr_type, @@ -474,7 +483,7 @@ class ApiQueryInfo extends ApiQueryBase { $this->protections[$title->getNamespace()][$title->getDBkey()][] = $a; } // Also check old restrictions - foreach( $this->titles as $pageId => $title ) { + foreach ( $this->titles as $pageId => $title ) { if ( $this->pageRestrictions[$pageId] ) { $namespace = $title->getNamespace(); $dbKey = $title->getDBkey(); @@ -597,6 +606,7 @@ class ApiQueryInfo extends ApiQueryBase { private function getTSIDs() { $getTitles = $this->talkids = $this->subjectids = array(); + /** @var $t Title */ foreach ( $this->everything as $t ) { if ( MWNamespace::isTalk( $t->getNamespace() ) ) { if ( $this->fld_subjectid ) { @@ -816,7 +826,8 @@ class ApiQueryInfo extends ApiQueryBase { 'starttimestamp' => array( ApiBase::PROP_TYPE => 'timestamp', ApiBase::PROP_NULLABLE => true - ) + ), + 'contentmodel' => 'string', ), 'watched' => array( 'watched' => 'boolean'