X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryInfo.php;h=017684edd321db35566fc7e5223071e1e4569495;hb=18062eb3b08905340da38d34586c10fdd2e60631;hp=37cd9159ad23a4b5edb3bdebeffb18d2b109b0d1;hpb=fba4fdb7ed7b20e84ac86ffadce03acbc8691f85;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 37cd9159ad..017684edd3 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' ); + } } /** @@ -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; @@ -476,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(); @@ -662,7 +669,9 @@ class ApiQueryInfo extends ApiQueryBase { private function getWatchedInfo() { $user = $this->getUser(); - if ( $user->isAnon() || count( $this->everything ) == 0 ) { + if ( $user->isAnon() || count( $this->everything ) == 0 + || !$user->isAllowed( 'viewmywatchlist' ) + ) { return; } @@ -819,7 +828,8 @@ class ApiQueryInfo extends ApiQueryBase { 'starttimestamp' => array( ApiBase::PROP_TYPE => 'timestamp', ApiBase::PROP_NULLABLE => true - ) + ), + 'contentmodel' => 'string', ), 'watched' => array( 'watched' => 'boolean'