Update Admin\Install page
Set journal_mode=WAL by default for SQLite.
This commit is contained in:
parent
c0be6d857d
commit
ef78e141ba
2 changed files with 16 additions and 1 deletions
|
@ -82,6 +82,14 @@ class DB extends PDO
|
|||
$this->dbType = $type;
|
||||
$this->dbPrefix = $prefix;
|
||||
|
||||
if (isset($options['initSQLCommands'])) {
|
||||
$initSQLCommands = implode(';', $options['initSQLCommands']);
|
||||
|
||||
unset($options['initSQLCommands']);
|
||||
} else {
|
||||
$initSQLCommands = null;
|
||||
}
|
||||
|
||||
$options += [
|
||||
self::ATTR_DEFAULT_FETCH_MODE => self::FETCH_ASSOC,
|
||||
self::ATTR_EMULATE_PREPARES => false,
|
||||
|
@ -96,6 +104,10 @@ class DB extends PDO
|
|||
|
||||
$this->saveQuery('PDO::__construct()', \microtime(true) - $start, false);
|
||||
|
||||
if ($initSQLCommands) {
|
||||
$this->exec($initSQLCommands);
|
||||
}
|
||||
|
||||
$this->beginTransaction();
|
||||
}
|
||||
|
||||
|
|
|
@ -506,9 +506,12 @@ class Install extends Admin
|
|||
break;
|
||||
case 'sqlite':
|
||||
$this->c->DB_DSN = "sqlite:!PATH!{$dbname}";
|
||||
$this->c->DB_OPTS_AS_STR = '\\PDO::ATTR_TIMEOUT => 5,';
|
||||
$this->c->DB_OPTS_AS_STR = '\\PDO::ATTR_TIMEOUT => 5, \'initSQLCommands\' => [\'PRAGMA journal_mode=WAL\',],';
|
||||
$this->c->DB_OPTIONS = [
|
||||
PDO::ATTR_TIMEOUT => 5,
|
||||
'initSQLCommands' => [
|
||||
'PRAGMA journal_mode=WAL',
|
||||
],
|
||||
];
|
||||
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue