Index: trunk/extensions/SimpleSecurity/SimpleSecurity.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | if (!defined('MEDIAWIKI')) die('Not an entry point.'); |
23 | 23 | if (version_compare($wgVersion, '1.11.0') < 0) die('Sorry, this extension requires at least MediaWiki version 1.11.0'); |
24 | 24 | |
25 | | -define('SIMPLESECURITY_VERSION', '4.2.12, 2008-09-06'); |
| 25 | +define('SIMPLESECURITY_VERSION', '4.2.13, 2008-09-07'); |
26 | 26 | |
27 | 27 | # Global security settings |
28 | 28 | $wgSecurityMagicIf = "ifusercan"; # the name for doing a permission-based conditional |
— | — | @@ -53,6 +53,9 @@ |
54 | 54 | 'version' => SIMPLESECURITY_VERSION |
55 | 55 | ); |
56 | 56 | |
| 57 | +# SearchEngine is based on $wgDBtype so must be set before it gets changed to DatabaseSimpleSecurity |
| 58 | +SimpleSecurity::fixSearchType(); |
| 59 | + |
57 | 60 | # If the database class already exists, add the DB hook now, otherwise wait until extension setup |
58 | 61 | if (!isset($wgSecurityUseDBHook)) $wgSecurityUseDBHook = false; |
59 | 62 | if ($wgSecurityUseDBHook && class_exists('Database')) wfSimpleSecurityDBHook(); |
— | — | @@ -374,11 +377,25 @@ |
375 | 378 | } |
376 | 379 | } |
377 | 380 | |
378 | | - # Updates passed LoadBalancer's DB servers to secure class |
| 381 | + /** |
| 382 | + * Updates passed LoadBalancer's DB servers to secure class |
| 383 | + */ |
379 | 384 | static function updateLB(&$lb) { |
380 | 385 | $lb->closeAll(); |
381 | 386 | foreach ($lb->mServers as $i => $server) $lb->mServers[$i]['type'] = 'SimpleSecurity'; |
382 | 387 | } |
| 388 | + |
| 389 | + /** |
| 390 | + * Hack to ensure proper search class is used |
| 391 | + */ |
| 392 | + static function fixSearchType() { |
| 393 | + global $wgDBtype, $wgSearchType; |
| 394 | + if ($wgSearchType) return; |
| 395 | + elseif ($wgDBtype == 'mysql') $wgSearchType = 'SearchMySQL4'; |
| 396 | + elseif ($wgDBtype == 'postgres') $wgSearchType = 'SearchPostgres'; |
| 397 | + elseif ($wgDBtype == 'oracle') $wgSearchType = 'SearchOracle'; |
| 398 | + else $wgSearchType = 'SearchEngineDummy'; |
| 399 | + } |
383 | 400 | } |
384 | 401 | |
385 | 402 | /** |
— | — | @@ -428,7 +445,7 @@ |
429 | 446 | * Called from $wgExtensionFunctions array when initialising extensions |
430 | 447 | */ |
431 | 448 | function wfSetupSimpleSecurity() { |
432 | | - global $wgSimpleSecurity, $wgLanguageCode, $wgMessageCache, $wgSecurityUseDBHook, $wgLoadBalancer; |
| 449 | + global $wgSimpleSecurity, $wgLanguageCode, $wgMessageCache, $wgSecurityUseDBHook, $wgLoadBalancer; |
433 | 450 | |
434 | 451 | # Instantiate the SimpleSecurity singleton now that the environment is prepared |
435 | 452 | $wgSimpleSecurity = new SimpleSecurity(); |