Don't run the query if search is disabled!
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 24 Nov 2003 14:47:05 +0000 (14:47 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 24 Nov 2003 14:47:05 +0000 (14:47 +0000)
includes/SearchEngine.php

index 7253e6e..cca48df 100644 (file)
@@ -172,17 +172,17 @@ class SearchEngine {
                $searchnamespaces = $this->queryNamespaces();
                $redircond = $this->searchRedirects();
 
-               $sql = "SELECT cur_id,cur_namespace,cur_title," .
-                 "cur_text FROM cur,searchindex " .
-                 "WHERE cur_id=si_page AND {$this->mTitlecond} " .
-                 "{$searchnamespaces} {$redircond}" .
-                 "LIMIT {$offset}, {$limit}";
-               $res1 = wfQuery( $sql, DB_READ, $fname );
-               $num = wfNumRows($res1);
-
                if ( $wgDisableTextSearch ) {
                        $wgOut->addHTML( wfMsg( "searchdisabled", htmlspecialchars( $search ), $wgInputEncoding ) );
                } else {
+                       $sql = "SELECT cur_id,cur_namespace,cur_title," .
+                         "cur_text FROM cur,searchindex " .
+                         "WHERE cur_id=si_page AND {$this->mTitlecond} " .
+                         "{$searchnamespaces} {$redircond}" .
+                         "LIMIT {$offset}, {$limit}";
+                       $res1 = wfQuery( $sql, DB_READ, $fname );
+                       $num = wfNumRows($res1);
+
                        $sk = $wgUser->getSkin();
                        $text = wfMsg( "searchresulttext", $sk->makeKnownLink(
                          wfMsg( "searchhelppage" ), wfMsg( "searchingwikipedia" ) ) );