From: Sam Reed Date: Wed, 22 Dec 2010 20:43:22 +0000 (+0000) Subject: Minor followup to r78822, locally cache the cachedTimestamp so we don't have to do... X-Git-Tag: 1.31.0-rc.0~33171 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=2dc752fde31a72c343913a883028cbb4622d525e;p=lhc%2Fweb%2Fwiklou.git Minor followup to r78822, locally cache the cachedTimestamp so we don't have to do duplicate db calls for the same information --- diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 19a0d53ea8..480d74e27c 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -85,6 +85,8 @@ abstract class QueryPage extends SpecialPage { */ protected $numRows; + protected $cachedTimestamp = null; + /** * Wheter to show prev/next links */ @@ -416,9 +418,13 @@ abstract class QueryPage extends SpecialPage { } public function getCachedTimestamp() { - $dbr = wfGetDB( DB_SLAVE ); - $fname = get_class( $this ) . '::getCachedTimestamp'; - return $dbr->selectField( 'querycache_info', 'qci_timestamp', array( 'qci_type' => $this->getName() ), $fname ); + if ( !is_null( $this->cachedTimestamp ) ) { + $dbr = wfGetDB( DB_SLAVE ); + $fname = get_class( $this ) . '::getCachedTimestamp'; + $this->cachedTimestamp = $dbr->selectField( 'querycache_info', 'qci_timestamp', + array( 'qci_type' => $this->getName() ), $fname ); + } + return $this->cachedTimestamp; } /**