From b78006fe58f390fc18b17ebb14ba89f3f84156a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Fri, 16 Sep 2005 15:05:07 +0000 Subject: [PATCH] * Moved the logic of whether or not to use the querycache into a isCached() function --- includes/QueryPage.php | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 558b733051..41515cc426 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -96,6 +96,18 @@ class QueryPage { return $wgDisableQueryPages; } + /** + * Whether or not the output of the page in question is retrived from + * the database cache. + * + * @return bool + */ + function isCached() { + global $wgMiserMode; + + return $this->isExpensive() && $wgMiserMode; + } + /** * Sometime we dont want to build rss / atom feeds. */ @@ -218,8 +230,7 @@ class QueryPage { */ function doQuery( $offset, $limit, $shownavigation=true ) { global $wgUser, $wgOut, $wgLang, $wgRequest, $wgContLang; - global $wgMiserMode; - + $sname = $this->getName(); $fname = get_class($this) . '::doQuery'; $sql = $this->getSQL(); @@ -229,15 +240,12 @@ class QueryPage { $wgOut->setSyndicated( $this->isSyndicated() ); - if ( $this->isExpensive() ) { - // Disabled recache parameter due to retry problems -- TS - if( $wgMiserMode ) { - $type = $dbr->strencode( $sname ); - $sql = - "SELECT qc_type as type, qc_namespace as namespace,qc_title as title, qc_value as value - FROM $querycache WHERE qc_type='$type'"; - $wgOut->addWikiText( wfMsg( 'perfcached' ) ); - } + if ( $this->isCached() ) { + $type = $dbr->strencode( $sname ); + $sql = + "SELECT qc_type as type, qc_namespace as namespace,qc_title as title, qc_value as value + FROM $querycache WHERE qc_type='$type'"; + $wgOut->addWikiText( wfMsg( 'perfcached' ) ); } $sql .= $this->getOrder(); -- 2.20.1