mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Fix PDO driver initialization
This commit is contained in:
parent
c4ca9149a1
commit
471dad0645
1 changed files with 5 additions and 4 deletions
|
@ -20,16 +20,17 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
||||||
|
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
public function __construct(string $dbFile = null) {
|
public function __construct(string $dbFile = null, string $dbKey = null) {
|
||||||
// check to make sure required extension is loaded
|
// check to make sure required extension is loaded
|
||||||
if (!self::requirementsMet()) {
|
if (!static::requirementsMet()) {
|
||||||
throw new Exception("extMissing", self::driverName()); // @codeCoverageIgnore
|
throw new Exception("extMissing", static::driverName()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
// if no database file is specified in the configuration, use a suitable default
|
// if no database file is specified in the configuration, use a suitable default
|
||||||
$dbFile = $dbFile ?? Arsse::$conf->dbSQLite3File ?? \JKingWeb\Arsse\BASE."arsse.db";
|
$dbFile = $dbFile ?? Arsse::$conf->dbSQLite3File ?? \JKingWeb\Arsse\BASE."arsse.db";
|
||||||
|
$dbKey = $dbKey ?? Arsse::$conf->dbSQLite3Key;
|
||||||
$timeout = Arsse::$conf->dbSQLite3Timeout * 1000;
|
$timeout = Arsse::$conf->dbSQLite3Timeout * 1000;
|
||||||
try {
|
try {
|
||||||
$this->makeConnection($dbFile, Arsse::$conf->dbSQLite3Key);
|
$this->makeConnection($dbFile, $dbKey);
|
||||||
// set the timeout; parameters are not allowed for pragmas, but this usage should be safe
|
// set the timeout; parameters are not allowed for pragmas, but this usage should be safe
|
||||||
$this->exec("PRAGMA busy_timeout = $timeout");
|
$this->exec("PRAGMA busy_timeout = $timeout");
|
||||||
// set other initial options
|
// set other initial options
|
||||||
|
|
Loading…
Reference in a new issue