From 526a693ead7315c552eb3ea74ba08b9097aa9816 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 6 Oct 2025 08:04:16 +0400 Subject: [PATCH] =?UTF-8?q?changer=20la=20configuration=20par=20d=C3=A9fau?= =?UTF-8?q?t=20pour=20mysql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php/src/db/mysql/Mysql.php | 11 +++++++++++ php/src/db/pdo/Pdo.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/php/src/db/mysql/Mysql.php b/php/src/db/mysql/Mysql.php index f0a0e75..52b93d6 100644 --- a/php/src/db/mysql/Mysql.php +++ b/php/src/db/mysql/Mysql.php @@ -6,11 +6,22 @@ use nulib\db\pdo\Pdo; class Mysql extends Pdo { const PREFIX = "mysql"; + static function config_setTimeout(self $pdo): void { + $pdo->_exec("SET session wait_timeout=28800"); + $pdo->_exec("SET session interactive_timeout=28800"); + } + const CONFIG_setTimeout = [self::class, "config_setTimeout"]; + static function config_unbufferedQueries(self $mysql): void { $mysql->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); } const CONFIG_unbufferedQueries = [self::class, "config_unbufferedQueries"]; + const DEFAULT_CONFIG = [ + ...parent::DEFAULT_CONFIG, + self::CONFIG_setTimeout, + ]; + function getDbname(): ?string { $url = $this->dbconn["name"] ?? null; if ($url !== null && preg_match('/^mysql(?::|.*;)dbname=([^;]+)/i', $url, $ms)) { diff --git a/php/src/db/pdo/Pdo.php b/php/src/db/pdo/Pdo.php index 500d385..ba92e99 100644 --- a/php/src/db/pdo/Pdo.php +++ b/php/src/db/pdo/Pdo.php @@ -42,7 +42,7 @@ class Pdo implements IDatabase { const CONFIG_errmodeException_lowerCase = [self::class, "config_errmodeException_lowerCase"]; protected const OPTIONS = [ - \PDO::ATTR_PERSISTENT => true, + \PDO::ATTR_PERSISTENT => false, ]; protected const DEFAULT_CONFIG = [