mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX DB::connect() should not rely on $_SESSION existing, so we check isset() to supress any warnings of undefined indexes
MINOR Code formatting tidy of DB::connect() function git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@111772 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a9d752b344
commit
10f8318e32
@ -83,7 +83,9 @@ class DB {
|
||||
*/
|
||||
static function connect($databaseConfig) {
|
||||
// This is used by TestRunner::startsession() to test up a test session using an alt
|
||||
if(isset($_SESSION["alternativeDatabaseName"]) && $dbname = $_SESSION["alternativeDatabaseName"]) $databaseConfig['database'] = $dbname;
|
||||
if(isset($_SESSION) && !empty($_SESSION['alternativeDatabaseName'])) {
|
||||
$databaseConfig['database'] = $_SESSION['alternativeDatabaseName'];
|
||||
}
|
||||
|
||||
if(!isset($databaseConfig['type']) || empty($databaseConfig['type'])) {
|
||||
user_error("DB::connect: Not passed a valid database config", E_USER_ERROR);
|
||||
@ -333,4 +335,3 @@ class DB {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user