From: Alexandre Emsenhuber Date: Sun, 30 Mar 2008 17:43:51 +0000 (+0000) Subject: * Fixes for Parser tests (was broken with new load balancing system), added LBFactory... X-Git-Tag: 1.31.0-rc.0~48728 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=83d733814447aa168db9ef9b3c702e65ff191bfe;p=lhc%2Fweb%2Fwiklou.git * Fixes for Parser tests (was broken with new load balancing system), added LBFactory::destroy() to destroy the singleton instance and force reopening a connection with the new value of $wgDBprefix. * Added new globals to override: ** $wgGroupPermissions : restore default value for anons, some tests don't pass if anons aren't allowed to edit (there isn't "edit section" links) ** $wgDefaultExternalStore : don't use external sotrage since there isn't a table extdb.parsertest_blobs --- diff --git a/includes/LBFactory.php b/includes/LBFactory.php index e0ffbc85f8..6370f6506c 100644 --- a/includes/LBFactory.php +++ b/includes/LBFactory.php @@ -18,6 +18,15 @@ abstract class LBFactory { return self::$instance; } + /** + * Destory the instance + * Actually used by maintenace/parserTests.inc to force to reopen connection + * when $wgDBprefix has changed + */ + static function destroy(){ + self::$instance = null; + } + /** * Construct a factory based on a configuration array (typically from $wgLBFactoryConf) */ diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index e08a5d2c41..0e943a090b 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -402,6 +402,14 @@ class ParserTest { 'wgUseTidy' => false, 'wgDefaultLanguageVariant' => $variant, 'wgVariantArticlePath' => false, + 'wgGroupPermissions' => array( '*' => array( + 'createaccount' => true, + 'read' => true, + 'edit' => true, + 'createpage' => true, + 'createtalk' => true, + ) ), + 'wgDefaultExternalStore' => array(), ); $this->savedGlobals = array(); foreach( $settings as $var => $val ) { @@ -412,7 +420,6 @@ class ParserTest { $GLOBALS['wgLang'] = $langObj; $GLOBALS['wgContLang'] = $langObj; - $GLOBALS['wgLoadBalancer']->loadMasterPos(); //$GLOBALS['wgMessageCache'] = new MessageCache( new BagOStuff(), false, 0, $GLOBALS['wgDBname'] ); $this->setupDatabase(); @@ -458,7 +465,7 @@ class ParserTest { # Make sure we don't mess with the live DB if (!$setupDB && $wgDBprefix === 'parsertest_') { # oh teh horror - $GLOBALS['wgLoadBalancer'] = LoadBalancer::newFromParams( $GLOBALS['wgDBservers'] ); + LBFactory::destroy(); $db = wfGetDB( DB_MASTER ); $tables = $this->listTables();