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