Add support for %cwd% variable in pdo dsn.
The string %cwd% gets replaced in a pdo dsn with the cwd used to create the game. This is important since daenerys would access a different sqlite database file than web/app.php
This commit is contained in:
+8
-2
@@ -86,9 +86,15 @@ class Bootstrap
|
||||
* @param \LotGD\Core\Configuration $config
|
||||
* @return \PDO
|
||||
*/
|
||||
protected function connectToDatabase(Configuration $config): \PDO
|
||||
protected function connectToDatabase(Configuration $config, string $cwd): \PDO
|
||||
{
|
||||
return new \PDO($config->getDatabaseDSN(), $config->getDatabaseUser(), $config->getDatabasePassword());
|
||||
$dsn = str_replace("%cwd%", $cwd, $config->getDatabaseDSN());
|
||||
|
||||
return new \PDO(
|
||||
$dsn,
|
||||
$config->getDatabaseUser(),
|
||||
$config->getDatabasePassword()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user