mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
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:
parent
728bcfe470
commit
23a41ebf92
@ -32,4 +32,8 @@ It will create 3^5 pages by default, so takes a while to run through.
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
The module is intended to run against the latest core codebase,
|
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
|
32
_config.php
32
_config.php
@ -13,38 +13,6 @@ 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']) {
|
if(@$_GET['db']) {
|
||||||
$enabletranslatable = @$_GET['enabletranslatable'];
|
$enabletranslatable = @$_GET['enabletranslatable'];
|
||||||
} elseif(@$_SESSION['db']) {
|
} elseif(@$_SESSION['db']) {
|
||||||
|
Loading…
Reference in New Issue
Block a user