BUGFIX Moved db switching to separate module which is included later in the manifest, which means it doesn't get overwritten by ConfigureFromEnv.php in mysite

This commit is contained in:
Ingo Schommer 2012-05-01 14:56:30 +02:00
parent 728bcfe470
commit 23a41ebf92
2 changed files with 5 additions and 33 deletions

View File

@ -32,4 +32,8 @@ It will create 3^5 pages by default, so takes a while to run through.
## Requirements
The module is intended to run against the latest core codebase,
but also includes branches matching earlier core releases for backwards compatibility.
but also includes branches matching earlier core releases for backwards compatibility.
## Related
* [zframeworktest_dbswitcher](https://github.com/silverstripe-labs/zframeworktest_dbswitcher) module - adds capabilities to switch the database by a query parameter for testing purposes

View File

@ -13,38 +13,6 @@ Director::addRules(100, array(
'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']) {