From: Ævar Arnfjörð Bjarmason Date: Fri, 16 Sep 2005 15:05:07 +0000 (+0000) Subject: * Moved the logic of whether or not to use the querycache into a isCached() function X-Git-Tag: 1.6.0~1633 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=b78006fe58f390fc18b17ebb14ba89f3f84156a6;p=lhc%2Fweb%2Fwiklou.git * Moved the logic of whether or not to use the querycache into a isCached() function --- 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();