MINOR Moved config switching from mysite (in build env) to frameworktest

This commit is contained in:
Ingo Schommer 2010-05-03 20:45:17 +00:00
parent b0a5768bb0
commit 1e7bd37eeb

View File

@ -10,4 +10,48 @@ CMSWorkflowSiteConfigDecorator::apply_active_config();
Director::addRules(100, array( Director::addRules(100, array(
'dev/regress/$Action/$ID' => 'FrameworktestRegressSessionAdmin' 'dev/regress/$Action/$ID' => 'FrameworktestRegressSessionAdmin'
)); ));
Session::start();
if(@$_GET['db']) {
$db = $_GET['db'];
} elseif(@$_SESSION['db']) {
$db = $_SESSION['db'];
} else {
$db = null;
}
if($db) {
global $databaseConfig;
if($db == 'mysql') {
$databaseConfig['type'] = 'MySQLDatabase';
$databaseConfig['server'] = SS_MYSQL_DATABASE_SERVER;
$databaseConfig['username'] = SS_MYSQL_DATABASE_USERNAME;
$databaseConfig['password'] = SS_MYSQL_DATABASE_PASSWORD;
} else if($db == 'postgresql') {
$databaseConfig['type'] = 'PostgreSQLDatabase';
$databaseConfig['server'] = SS_PGSQL_DATABASE_SERVER;
$databaseConfig['username'] = SS_PGSQL_DATABASE_USERNAME;
$databaseConfig['password'] = SS_PGSQL_DATABASE_PASSWORD;
} else if($db == 'mssql') {
$databaseConfig['type'] = 'MSSQLDatabase';
$databaseConfig['server'] = SS_MSSQL_DATABASE_SERVER;
$databaseConfig['username'] = SS_MSSQL_DATABASE_USERNAME;
$databaseConfig['password'] = SS_MSSQL_DATABASE_PASSWORD;
} else if($db == 'sqlite3') {
$databaseConfig['type'] = 'SQLite3Database';
} else {
// stick with default settings set through ConfigureFromEnv
}
}
if(@$_GET['db']) {
$enabletranslatable = $_GET['enabletranslatable'];
} elseif(@$_SESSION['db']) {
$enabletranslatable = $_SESSION['enabletranslatable'];
} else {
$enabletranslatable = null;
}
if($enabletranslatable) {
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');
}
?> ?>