Index: trunk/phase3/includes/search/SearchEngine.php |
— | — | @@ -22,6 +22,14 @@ |
23 | 23 | var $namespaces = array( NS_MAIN ); |
24 | 24 | var $showRedirects = false; |
25 | 25 | |
| 26 | + function __construct($db = null) { |
| 27 | + if ( $db ) { |
| 28 | + $this->db = $db; |
| 29 | + } else { |
| 30 | + $this->db = wfGetDB( DB_SLAVE ); |
| 31 | + } |
| 32 | + } |
| 33 | + |
26 | 34 | /** |
27 | 35 | * Perform a full text search query and return a result set. |
28 | 36 | * If title searches are not supported or disabled, return null. |
— | — | @@ -383,10 +391,11 @@ |
384 | 392 | */ |
385 | 393 | public static function create() { |
386 | 394 | global $wgSearchType; |
387 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 395 | + $dbr = null; |
388 | 396 | if ( $wgSearchType ) { |
389 | 397 | $class = $wgSearchType; |
390 | 398 | } else { |
| 399 | + $dbr = wfGetDB( DB_SLAVE ); |
391 | 400 | $class = $dbr->getSearchEngine(); |
392 | 401 | } |
393 | 402 | $search = new $class( $dbr ); |
Index: trunk/phase3/includes/search/SearchMySQL.php |
— | — | @@ -32,9 +32,12 @@ |
33 | 33 | var $strictMatching = true; |
34 | 34 | static $mMinSearchLength; |
35 | 35 | |
36 | | - /** @todo document */ |
| 36 | + /** |
| 37 | + * Creates an instance of this class |
| 38 | + * @param $db DatabaseMysql: database object |
| 39 | + */ |
37 | 40 | function __construct( $db ) { |
38 | | - $this->db = $db; |
| 41 | + parent::__construct( $db ); |
39 | 42 | } |
40 | 43 | |
41 | 44 | /** |
— | — | @@ -410,4 +413,4 @@ |
411 | 414 | function getTotalHits() { |
412 | 415 | return $this->mTotalHits; |
413 | 416 | } |
414 | | -} |
\ No newline at end of file |
| 417 | +} |
Index: trunk/phase3/includes/search/SearchOracle.php |
— | — | @@ -56,9 +56,13 @@ |
57 | 57 | 'TRSYN' => 1, |
58 | 58 | 'TT' => 1, |
59 | 59 | 'WITHIN' => 1); |
60 | | - |
| 60 | + |
| 61 | + /** |
| 62 | + * Creates an instance of this class |
| 63 | + * @param $db DatabasePostgres: database object |
| 64 | + */ |
61 | 65 | function __construct($db) { |
62 | | - $this->db = $db; |
| 66 | + parent::__construct( $db ); |
63 | 67 | } |
64 | 68 | |
65 | 69 | /** |
Index: trunk/phase3/includes/search/SearchPostgres.php |
— | — | @@ -29,9 +29,12 @@ |
30 | 30 | * @ingroup Search |
31 | 31 | */ |
32 | 32 | class SearchPostgres extends SearchEngine { |
33 | | - |
| 33 | + /** |
| 34 | + * Creates an instance of this class |
| 35 | + * @param $db DatabaseSqlite: database object |
| 36 | + */ |
34 | 37 | function __construct( $db ) { |
35 | | - $this->db = $db; |
| 38 | + parent::__construct( $db ); |
36 | 39 | } |
37 | 40 | |
38 | 41 | /** |
Index: trunk/phase3/includes/search/SearchIBM_DB2.php |
— | — | @@ -29,8 +29,13 @@ |
30 | 30 | * @ingroup Search |
31 | 31 | */ |
32 | 32 | class SearchIBM_DB2 extends SearchEngine { |
| 33 | + |
| 34 | + /** |
| 35 | + * Creates an instance of this class |
| 36 | + * @param $db DatabaseIbm_db2: database object |
| 37 | + */ |
33 | 38 | function __construct($db) { |
34 | | - $this->db = $db; |
| 39 | + parent::__construct( $db ); |
35 | 40 | } |
36 | 41 | |
37 | 42 | /** |
Index: trunk/phase3/includes/search/SearchMssql.php |
— | — | @@ -27,8 +27,12 @@ |
28 | 28 | */ |
29 | 29 | class SearchMssql extends SearchEngine { |
30 | 30 | |
| 31 | + /** |
| 32 | + * Creates an instance of this class |
| 33 | + * @param $db DatabaseMssql: database object |
| 34 | + */ |
31 | 35 | function __construct( $db ) { |
32 | | - $this->db = $db; |
| 36 | + parent::__construct( $db ); |
33 | 37 | } |
34 | 38 | |
35 | 39 | /** |
Index: trunk/phase3/includes/search/SearchSqlite.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | * @param $db DatabaseSqlite: database object |
33 | 33 | */ |
34 | 34 | function __construct( $db ) { |
35 | | - $this->db = $db; |
| 35 | + parent::__construct( $db ); |
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
— | — | @@ -331,4 +331,4 @@ |
332 | 332 | function getTotalHits() { |
333 | 333 | return $this->mTotalHits; |
334 | 334 | } |
335 | | -} |
\ No newline at end of file |
| 335 | +} |
Index: trunk/extensions/SphinxSearch/SphinxMWSearch.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * @author Svemir Brkic <svemir@deveblog.com> |
14 | 14 | */ |
15 | 15 | |
16 | | - class SphinxMWSearch extends SearchEngine { |
| 16 | +class SphinxMWSearch extends SearchEngine { |
17 | 17 | |
18 | 18 | var $categories = array(); |
19 | 19 | var $exc_categories = array(); |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | var $sphinx_client = null; |
22 | 22 | |
23 | 23 | function __construct( $db ) { |
24 | | - $this->db = $db; |
| 24 | + parent::__construct( $db ); |
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
— | — | @@ -382,4 +382,4 @@ |
383 | 383 | return $ret; |
384 | 384 | } |
385 | 385 | |
386 | | -} |
\ No newline at end of file |
| 386 | +} |