Save two function calls when pages are not cached.
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 16 Dec 2006 21:32:11 +0000 (21:32 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 16 Dec 2006 21:32:11 +0000 (21:32 +0000)
includes/QueryPage.php

index 850365c..e4f5551 100644 (file)
@@ -282,13 +282,15 @@ class QueryPage {
 
                $sname = $this->getName();
                $fname = get_class($this) . '::doQuery';
-               $sql = $this->getSQL();
                $dbr =& wfGetDB( DB_SLAVE );
-               $querycache = $dbr->tableName( 'querycache' );
 
                $wgOut->setSyndicated( $this->isSyndicated() );
 
-               if ( $this->isCached() ) {
+               if ( !$this->isCached() ) {
+                       $sql = $this->getSQL();
+               } else {
+                       # Get the cached result
+                       $querycache = $dbr->tableName( 'querycache' );
                        $type = $dbr->strencode( $sname );
                        $sql =
                                "SELECT qc_type as type, qc_namespace as namespace,qc_title as title, qc_value as value