From ad801d84863debfab8aee3be0c47e9e04d68d589 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Wed, 9 Jul 2025 17:49:05 +0400 Subject: [PATCH 1/5] modifs.mineures sans commentaires --- composer.json | 2 ++ php/src/txt.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ad4668a..72c693e 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,8 @@ }, "require-dev": { "nulib/tests": "^7.4", + "ext-mbstring": "*", + "ext-iconv": "*", "ext-posix": "*", "ext-pcntl": "*", "ext-curl": "*", diff --git a/php/src/txt.php b/php/src/txt.php index 9857473..2c5ef53 100644 --- a/php/src/txt.php +++ b/php/src/txt.php @@ -276,7 +276,7 @@ class txt { * supprimer les diacritiques de la chaine $text * * la translitération se fait avec les règles de la locale spécifiée. - * NB: la translitération ne fonctionne pas si LC_CTYPE == C ou POISX + * NB: la translitération ne fonctionne pas si LC_CTYPE == C ou POSIX */ static final function remove_diacritics(?string $text, string $locale="fr_FR.UTF-8"): ?string { if ($text === null) return null; From 8f5c30c8c1eaeacfd5d0daeb11cb48e49cec27d8 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 10 Jul 2025 18:06:19 +0400 Subject: [PATCH 2/5] =?UTF-8?q?forcer=20le=20timeout=20au=20d=C3=A9but?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php/src/db/mysql/Mysql.php | 15 +++++++++++++++ php/src/db/pdo/Pdo.php | 5 ----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/php/src/db/mysql/Mysql.php b/php/src/db/mysql/Mysql.php index 3031583..f3ba8b7 100644 --- a/php/src/db/mysql/Mysql.php +++ b/php/src/db/mysql/Mysql.php @@ -6,6 +6,21 @@ use nulib\db\pdo\Pdo; class Mysql extends Pdo { const PREFIX = "mysql"; + static function config_setWaitTimeout(self $mysql): void { + $mysql->_exec("set session wait_timeout = 28800"); + } + const CONFIG_setWaitTimeout = [self::class, "config_setWaitTimeout"]; + + static function config_unbufferedQueries(self $mysql): void { + $mysql->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + } + const CONFIG_unbufferedQueries = [self::class, "config_unbufferedQueries"]; + + protected const DEFAULT_CONFIG = [ + ...parent::DEFAULT_CONFIG, + self::CONFIG_setWaitTimeout, + ]; + 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 094b784..d06f5dd 100644 --- a/php/src/db/pdo/Pdo.php +++ b/php/src/db/pdo/Pdo.php @@ -40,11 +40,6 @@ class Pdo implements IDatabase { } const CONFIG_errmodeException_lowerCase = [self::class, "config_errmodeException_lowerCase"]; - static function config_unbufferedQueries(self $pdo): void { - $pdo->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); - } - const CONFIG_unbufferedQueries = [self::class, "config_unbufferedQueries"]; - protected const OPTIONS = [ \PDO::ATTR_PERSISTENT => true, ]; From 8cc8baca1060117b3d8c6ecf284c5dbc74de5dcf Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 15 Jul 2025 10:03:11 +0400 Subject: [PATCH 3/5] =?UTF-8?q?ne=20plus=20changer=20la=20session=20par=20?= =?UTF-8?q?d=C3=A9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php/src/db/mysql/Mysql.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/php/src/db/mysql/Mysql.php b/php/src/db/mysql/Mysql.php index f3ba8b7..f0a0e75 100644 --- a/php/src/db/mysql/Mysql.php +++ b/php/src/db/mysql/Mysql.php @@ -6,21 +6,11 @@ use nulib\db\pdo\Pdo; class Mysql extends Pdo { const PREFIX = "mysql"; - static function config_setWaitTimeout(self $mysql): void { - $mysql->_exec("set session wait_timeout = 28800"); - } - const CONFIG_setWaitTimeout = [self::class, "config_setWaitTimeout"]; - static function config_unbufferedQueries(self $mysql): void { $mysql->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); } const CONFIG_unbufferedQueries = [self::class, "config_unbufferedQueries"]; - protected const DEFAULT_CONFIG = [ - ...parent::DEFAULT_CONFIG, - self::CONFIG_setWaitTimeout, - ]; - function getDbname(): ?string { $url = $this->dbconn["name"] ?? null; if ($url !== null && preg_match('/^mysql(?::|.*;)dbname=([^;]+)/i', $url, $ms)) { From 6238e0b9ff8f7fa311a3f1cac5d089e2091b06ee Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 15 Jul 2025 14:18:45 +0400 Subject: [PATCH 4/5] modifs.mineures sans commentaires --- php/src/app/TODO.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 php/src/app/TODO.md diff --git a/php/src/app/TODO.md b/php/src/app/TODO.md new file mode 100644 index 0000000..142c37e --- /dev/null +++ b/php/src/app/TODO.md @@ -0,0 +1,7 @@ +# nulib\app + +* [ ] ajouter des méthodes normalisées `app::get_cachedir()` et + `app::get_cachefile($name)` avec la valeur par défaut + `cachedir = $vardir/cache` + +-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary \ No newline at end of file From f221342c092dc9c8a9663ddf04e14242123412ba Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 15 Jul 2025 16:50:24 +0400 Subject: [PATCH 5/5] =?UTF-8?q?support=20arr=C3=AAt=20de=20each()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php/src/db/CapacitorChannel.php | 5 +++-- php/src/db/CapacitorStorage.php | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/php/src/db/CapacitorChannel.php b/php/src/db/CapacitorChannel.php index 0c2b370..3489203 100644 --- a/php/src/db/CapacitorChannel.php +++ b/php/src/db/CapacitorChannel.php @@ -366,13 +366,14 @@ class CapacitorChannel implements ITransactor { } /** - * méthode appelée lors du parcours des éléments avec - * {@link Capacitor::each()} + * méthode appelée lors du parcours des éléments avec {@link Capacitor::each()} * * @param ?array $row la ligne courante. l'élément courant est accessible via * $row["item"] * @return ?array le cas échéant, un tableau non null utilisé pour mettre à * jour la ligne courante + * Retourner [false] pour arrêter le parcours des éléments (la ligne courante + * ainsi que les autres lignes ne sont plus mise à jour) * * - Il est possible de mettre à jour $item en le retourant avec la clé "item" * - La clé primaire (il s'agit généralement de "id_") ne peut pas être diff --git a/php/src/db/CapacitorStorage.php b/php/src/db/CapacitorStorage.php index 65aa09c..f529839 100644 --- a/php/src/db/CapacitorStorage.php +++ b/php/src/db/CapacitorStorage.php @@ -661,7 +661,9 @@ abstract class CapacitorStorage { foreach ($rows as $row) { $rowIds = $this->getRowIds($channel, $row); $updates = $onEach->invoke([$row, ...$args]); - if (is_array($updates) && $updates) { + if ($updates === [false]) { + break; + } elseif ($updates !== null) { if (!array_key_exists("modified_", $updates)) { $updates["modified_"] = date("Y-m-d H:i:s"); }