Changing URLs of mediawiki.org in scripts to the SSL-based website
[lhc/web/wiklou.git] / includes / search / SearchOracle.php
index dd152f7..4532178 100644 (file)
@@ -3,7 +3,7 @@
  * Oracle search engine
  *
  * Copyright © 2004 Brion Vibber <brion@pobox.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
  * Search engine hook base class for Oracle (ConText).
  * @ingroup Search
  */
-class SearchOracle extends SearchEngine {
+class SearchOracle extends SearchDatabase {
 
        private $reservedWords = array(
                'ABOUT' => 1,
@@ -59,14 +59,6 @@ class SearchOracle extends SearchEngine {
                'WITHIN' => 1,
        );
 
-       /**
-        * Creates an instance of this class
-        * @param $db DatabasePostgres: database object
-        */
-       function __construct( $db ) {
-               parent::__construct( $db );
-       }
-
        /**
         * Perform a full text search query and return a result set.
         *
@@ -74,8 +66,9 @@ class SearchOracle extends SearchEngine {
         * @return SqlSearchResultSet
         */
        function searchText( $term ) {
-               if ( $term == '' )
+               if ( $term == '' ) {
                        return new SqlSearchResultSet( false, '' );
+               }
 
                $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), true ) ) );
                return new SqlSearchResultSet( $resultSet, $this->searchTerms );
@@ -88,8 +81,9 @@ class SearchOracle extends SearchEngine {
         * @return SqlSearchResultSet
         */
        function searchTitle( $term ) {
-               if ( $term == '' )
+               if ( $term == '' ) {
                        return new SqlSearchResultSet( false, '' );
+               }
 
                $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) );
                return new MySQLSearchResultSet( $resultSet, $this->searchTerms );
@@ -112,8 +106,9 @@ class SearchOracle extends SearchEngine {
         * @return String
         */
        function queryNamespaces() {
-               if( is_null( $this->namespaces ) )
+               if ( is_null( $this->namespaces ) ) {
                        return '';
+               }
                if ( !count( $this->namespaces ) ) {
                        $namespaces = '0';
                } else {
@@ -197,23 +192,24 @@ class SearchOracle extends SearchEngine {
                $searchon = '';
                if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                                $filteredText, $m, PREG_SET_ORDER ) ) {
-                       foreach( $m as $terms ) {
+                       foreach ( $m as $terms ) {
                                // Search terms in all variant forms, only
                                // apply on wiki with LanguageConverter
                                $temp_terms = $wgContLang->autoConvertToAllVariants( $terms[2] );
-                               if( is_array( $temp_terms ) ) {
+                               if ( is_array( $temp_terms ) ) {
                                        $temp_terms = array_unique( array_values( $temp_terms ) );
-                                       foreach( $temp_terms as $t ) {
-                                               $searchon .= ($terms[1] == '-' ? ' ~' : ' & ') . $this->escapeTerm( $t );
+                                       foreach ( $temp_terms as $t ) {
+                                               $searchon .= ( $terms[1] == '-' ? ' ~' : ' & ' ) . $this->escapeTerm( $t );
                                        }
                                }
                                else {
-                                       $searchon .= ($terms[1] == '-' ? ' ~' : ' & ') . $this->escapeTerm( $terms[2] );
+                                       $searchon .= ( $terms[1] == '-' ? ' ~' : ' & ' ) . $this->escapeTerm( $terms[2] );
                                }
                                if ( !empty( $terms[3] ) ) {
                                        $regexp = preg_quote( $terms[3], '/' );
-                                       if ( $terms[4] )
+                                       if ( $terms[4] ) {
                                                $regexp .= "[0-9A-Za-z_]+";
+                                       }
                                } else {
                                        $regexp = preg_quote( str_replace( '"', '', $terms[2] ), '/' );
                                }
@@ -275,7 +271,7 @@ class SearchOracle extends SearchEngine {
 
                $dbw->update( 'searchindex',
                        array( 'si_title' => $title ),
-                       array( 'si_page'  => $id ),
+                       array( 'si_page' => $id ),
                        'SearchOracle::updateTitle',
                        array() );
        }