Configuration if the database is opened with persistent connections
This commit is contained in:
parent
0eec3e0a0e
commit
dfea3ee3d6
|
@ -134,6 +134,8 @@ class Database
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$persistent = (bool)$this->configCache->get('database', 'persistent');
|
||||||
|
|
||||||
$this->emulate_prepares = (bool)$this->configCache->get('database', 'emulate_prepares');
|
$this->emulate_prepares = (bool)$this->configCache->get('database', 'emulate_prepares');
|
||||||
$this->pdo_emulate_prepares = (bool)$this->configCache->get('database', 'pdo_emulate_prepares');
|
$this->pdo_emulate_prepares = (bool)$this->configCache->get('database', 'pdo_emulate_prepares');
|
||||||
|
|
||||||
|
@ -150,7 +152,7 @@ class Database
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->connection = @new PDO($connect, $user, $pass);
|
$this->connection = @new PDO($connect, $user, $pass, [PDO::ATTR_PERSISTENT => $persistent]);
|
||||||
$this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, $this->pdo_emulate_prepares);
|
$this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, $this->pdo_emulate_prepares);
|
||||||
$this->connected = true;
|
$this->connected = true;
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
|
|
@ -62,6 +62,13 @@ return [
|
||||||
// disable_pdo (Boolean)
|
// disable_pdo (Boolean)
|
||||||
// PDO is used by default (if available). Otherwise MySQLi will be used.
|
// PDO is used by default (if available). Otherwise MySQLi will be used.
|
||||||
'disable_pdo' => false,
|
'disable_pdo' => false,
|
||||||
|
|
||||||
|
// persistent (Boolean)
|
||||||
|
// This controls if the system should use persistent connections or not.
|
||||||
|
// Persistent connections increase the performance.
|
||||||
|
// On the other hand the number of open connections are higher,
|
||||||
|
// this will most likely increase the system load.
|
||||||
|
'persistent' => false,
|
||||||
],
|
],
|
||||||
'config' => [
|
'config' => [
|
||||||
// admin_email (Comma-separated list)
|
// admin_email (Comma-separated list)
|
||||||
|
|
Loading…
Reference in a new issue