From: Sam Reed Date: Mon, 24 Jan 2011 13:59:22 +0000 (+0000) Subject: Start another attack on raw sql queries X-Git-Tag: 1.31.0-rc.0~32396 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%2C%22id_auteur=%24connecte%22%29%20.%20%22?a=commitdiff_plain;h=668323434d4de425bf220abee829ae7687350a32;p=lhc%2Fweb%2Fwiklou.git Start another attack on raw sql queries --- diff --git a/includes/search/SearchMySQL.php b/includes/search/SearchMySQL.php index b92682adf2..b75f116dd2 100644 --- a/includes/search/SearchMySQL.php +++ b/includes/search/SearchMySQL.php @@ -196,7 +196,7 @@ class SearchMySQL extends SearchEngine { if( $this->showRedirects ) { return ''; } else { - return 'AND page_is_redirect=0'; + return 'page_is_redirect=0'; } } @@ -212,7 +212,7 @@ class SearchMySQL extends SearchEngine { } else { $namespaces = $this->db->makeList( $this->namespaces ); } - return 'AND page_namespace IN (' . $namespaces . ')'; + return 'page_namespace IN (' . $namespaces . ')'; } /** @@ -240,8 +240,8 @@ class SearchMySQL extends SearchEngine { */ function getQuery( $filteredTerm, $fulltext ) { return $this->queryMain( $filteredTerm, $fulltext ) . ' ' . - $this->queryRedirect() . ' ' . - $this->queryNamespaces() . ' ' . + 'AND ' . $this->queryRedirect() . ' ' . + 'AND ' . $this->queryNamespaces() . ' ' . $this->queryRanking( $filteredTerm, $fulltext ) . ' ' . $this->queryLimit(); } @@ -276,13 +276,15 @@ class SearchMySQL extends SearchEngine { function getCountQuery( $filteredTerm, $fulltext ) { $match = $this->parseQuery( $filteredTerm, $fulltext ); - $page = $this->db->tableName( 'page' ); - $searchindex = $this->db->tableName( 'searchindex' ); - return "SELECT COUNT(*) AS c " . - "FROM $page,$searchindex " . - 'WHERE page_id=si_page AND ' . $match . - $this->queryRedirect() . ' ' . - $this->queryNamespaces(); + + return $this->db->selectSQLText( array( 'page', 'searchindex' ), + 'COUNT(*) AS c', + array( + 'page_id=si_page', + $match, + $this->queryRedirect(), + $this->queryNamespaces() + ) ); } /**