From bfd1fd770a1c915635ebc3b8609ece7327491ecc Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 4 Nov 2010 13:10:38 +0000 Subject: [PATCH] * (bug 25760) counter property still reported by the API when wgDisableCounters enabled. If it's enabled, don't request counter information, and just display , to avoid breaking any backwards compatability --- RELEASE-NOTES | 2 ++ includes/api/ApiQueryInfo.php | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 192d21d169..84be7850c7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -487,6 +487,8 @@ LocalSettings.php. The specific bugs are listed below in the general notes. * The HTML of diff output markers has changed. Hyphens are now minus signs, empty markers are now filled with non-breaking-space characters * (bug 25741) Add more data to list=search's srprop +* (bug 25760) counter property still reported by the API when + $wgDisableCounters enabled === Languages updated in 1.17 === diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index fbef4cf75f..ffb6c0a170 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -48,10 +48,14 @@ class ApiQueryInfo extends ApiQueryBase { } public function requestExtraData( $pageSet ) { + global $wgDisablePageCounters; + $pageSet->requestField( 'page_restrictions' ); $pageSet->requestField( 'page_is_redirect' ); $pageSet->requestField( 'page_is_new' ); - $pageSet->requestField( 'page_counter' ); + if ( $wgDisablePageCounters ) { + $pageSet->requestField( 'page_counter' ); + } $pageSet->requestField( 'page_touched' ); $pageSet->requestField( 'page_latest' ); $pageSet->requestField( 'page_len' ); @@ -245,7 +249,12 @@ class ApiQueryInfo extends ApiQueryBase { $this->pageRestrictions = $pageSet->getCustomField( 'page_restrictions' ); $this->pageIsRedir = $pageSet->getCustomField( 'page_is_redirect' ); $this->pageIsNew = $pageSet->getCustomField( 'page_is_new' ); - $this->pageCounter = $pageSet->getCustomField( 'page_counter' ); + + global $wgDisablePageCounters; + + if ( !$wgDisablePageCounters ) { + $this->pageCounter = $pageSet->getCustomField( 'page_counter' ); + } $this->pageTouched = $pageSet->getCustomField( 'page_touched' ); $this->pageLatest = $pageSet->getCustomField( 'page_latest' ); $this->pageLength = $pageSet->getCustomField( 'page_len' ); @@ -292,9 +301,13 @@ class ApiQueryInfo extends ApiQueryBase { private function extractPageInfo( $pageid, $title ) { $pageInfo = array(); if ( $title->exists() ) { + global $wgDisablePageCounters; + $pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] ); $pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] ); - $pageInfo['counter'] = intval( $this->pageCounter[$pageid] ); + $pageInfo['counter'] = $wgDisablePageCounters + ? "" + : intval( $this->pageCounter[$pageid] ); $pageInfo['length'] = intval( $this->pageLength[$pageid] ); if ( $this->pageIsRedir[$pageid] ) { -- 2.20.1