mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
Compare commits
2 Commits
dc76ac2877
...
35f4268383
Author | SHA1 | Date | |
---|---|---|---|
|
35f4268383 | ||
|
402a9f931e |
@ -625,14 +625,9 @@ class TestSessionEnvironment
|
||||
|
||||
private function connectToDB(array $databaseConfig): void
|
||||
{
|
||||
if (method_exists(DB::class, 'hasConfig')) {
|
||||
// CMS 5.4+ - ensure we connect the primary connection and not a replica
|
||||
// which can happen if we use the default value of DB::CONN_DYNAMIC
|
||||
// and there is a replica database configured
|
||||
DB::connect($databaseConfig, DB::CONN_PRIMARY);
|
||||
} else {
|
||||
// CMS 5.3 and below do not support replica connections, use 'default' connection
|
||||
DB::connect($databaseConfig);
|
||||
}
|
||||
// Ensure we connect the primary connection and not a replica
|
||||
// which can happen if we use the default value of DB::CONN_DYNAMIC
|
||||
// and there is a replica database configured
|
||||
DB::connect($databaseConfig, DB::CONN_PRIMARY);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user