From 7bee23200b9144589f5e0589ac18f536839cf817 Mon Sep 17 00:00:00 2001 From: pifou25 Date: Sat, 1 Jun 2024 00:36:34 +0200 Subject: [PATCH 01/11] fix: set pdo err mode silent PDO error mode is silent as a default value before php8, I force it there to override the new php8 mode that is PDO Exception --- core/class/DB.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/class/DB.class.php b/core/class/DB.class.php index 83b7979179..4cd5a96487 100644 --- a/core/class/DB.class.php +++ b/core/class/DB.class.php @@ -34,10 +34,19 @@ class DB { private static function initConnection() { global $CONFIG; + $_options = [ + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci', + PDO::ATTR_PERSISTENT => true, + // silent mode, default for php7: https://www.php.net/manual/fr/pdo.error-handling.php + // exception mode for debug + PDO::ATTR_ERRMODE => (DEBUG ? PDO::ERRMODE_EXCEPTION : PDO::ERRMODE_SILENT), + ]; if (isset($CONFIG['db']['unix_socket'])) { - static::$connection = new PDO('mysql:unix_socket=' . $CONFIG['db']['unix_socket'] . ';dbname=' . $CONFIG['db']['dbname'], $CONFIG['db']['username'], $CONFIG['db']['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci', PDO::ATTR_PERSISTENT => true)); + static::$connection = new PDO('mysql:unix_socket=' . $CONFIG['db']['unix_socket'] . ';dbname=' . $CONFIG['db']['dbname'], + $CONFIG['db']['username'], $CONFIG['db']['password'], $_options); } else { - static::$connection = new PDO('mysql:host=' . $CONFIG['db']['host'] . ';port=' . $CONFIG['db']['port'] . ';dbname=' . $CONFIG['db']['dbname'], $CONFIG['db']['username'], $CONFIG['db']['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci', PDO::ATTR_PERSISTENT => true)); + static::$connection = new PDO('mysql:host=' . $CONFIG['db']['host'] . ';port=' . $CONFIG['db']['port'] . ';dbname=' . $CONFIG['db']['dbname'], + $CONFIG['db']['username'], $CONFIG['db']['password'], $_options); } } From 304684fa95c49017244f486772466d5270fb3937 Mon Sep 17 00:00:00 2001 From: Furaxworld <96196882+Furaxworld@users.noreply.github.com> Date: Mon, 3 Jun 2024 05:55:14 +0200 Subject: [PATCH 02/11] Update install.sh --- install/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/install.sh b/install/install.sh index f373b1facd..2c5076dd03 100644 --- a/install/install.sh +++ b/install/install.sh @@ -92,7 +92,7 @@ step_2_mainpackage() { step_3_database() { echo "---------------------------------------------------------------------" - echo "${YELLOW}Starting step 3 - databse${NORMAL}" + echo "${YELLOW}Starting step 3 - database${NORMAL}" apt_install mariadb-client mariadb-common mariadb-server service_action status mariadb From 813794c95c14302aaed22234ecf04bad229f73ff Mon Sep 17 00:00:00 2001 From: Furaxworld <96196882+Furaxworld@users.noreply.github.com> Date: Mon, 3 Jun 2024 05:56:34 +0200 Subject: [PATCH 03/11] Update restore.php --- install/restore.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/restore.php b/install/restore.php index c942839966..337bd327f9 100644 --- a/install/restore.php +++ b/install/restore.php @@ -144,7 +144,7 @@ } if (!file_exists($jeedom_dir . "/DB_backup.sql")) { - throw new Exception('Cannot find databse backup file : DB_backup.sql'); + throw new Exception('Cannot find database backup file : DB_backup.sql'); } echo "Deleting database..."; $tables = DB::Prepare("SHOW TABLES", array(), DB::FETCH_TYPE_ALL); @@ -186,7 +186,7 @@ echo "OK\n"; if (!file_exists(__DIR__ . '/../core/config/common.config.php')) { - echo "Restoring databse configuration file..."; + echo "Restoring database configuration file..."; copy('/tmp/common.config.php', __DIR__ . '/../core/config/common.config.php'); echo "OK\n"; } From d265c159dfd545610f88468d91180a2157aa7245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:40:27 +0200 Subject: [PATCH 04/11] #2663 --- core/class/timeline.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/class/timeline.class.php b/core/class/timeline.class.php index 30f5fd439f..e97e4ebf9e 100644 --- a/core/class/timeline.class.php +++ b/core/class/timeline.class.php @@ -122,11 +122,8 @@ public static function clean($_all = false) { if($delete_number <= 0){ return; } - $values = array( - 'number' => $delete_number, - ); $sql = 'DELETE FROM timeline ORDER BY `datetime` ASC LIMIT '.$delete_number; - DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW); + DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW); //ensure no duplicates: $sql = 'DELETE t1 FROM timeline t1 INNER JOIN timeline t2 WHERE '; From 1934dce23a26705e1730cce791dda8aa1e6d4720 Mon Sep 17 00:00:00 2001 From: David <79108364+Phpvarious@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:23:55 +0200 Subject: [PATCH 05/11] Update plan.js --- desktop/js/plan.js | 1 + 1 file changed, 1 insertion(+) diff --git a/desktop/js/plan.js b/desktop/js/plan.js index c10cc25258..75eb09172b 100644 --- a/desktop/js/plan.js +++ b/desktop/js/plan.js @@ -248,6 +248,7 @@ if (!jeeFrontEnd.plan) { jeedomUtils.addOrUpdateUrl('plan_id', jeephp2js.planHeader_id, data.name + ' - ' + JEEDOM_PRODUCT_NAME) jeeP.initEditOption(jeeFrontEnd.planEditOption.state) jeedomUtils.initReportMode() + jeedomUtils.initTooltips() window.scrollTo({top: 0, behavior: "smooth"}) jeeFrontEnd.plan.setGraphResizes() jeeFrontEnd.modifyWithoutSave = false From bba42e0c1570031a007b801db7e608799fe50ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:05:07 +0200 Subject: [PATCH 06/11] fix #2610 --- core/class/history.class.php | 6 +++--- core/config/default.config.ini | 1 + desktop/modal/cmd.configure.php | 5 +++-- desktop/php/administration.php | 13 +++++++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/core/class/history.class.php b/core/class/history.class.php index 2b8b9b0606..48e1872a8f 100644 --- a/core/class/history.class.php +++ b/core/class/history.class.php @@ -1027,14 +1027,14 @@ public function save($_cmd = null, $_direct = false) { $this->setValue(round($this->getValue(), $cmd->getConfiguration('historizeRound'))); } if ( $JEEDOM_INTERNAL_CONFIG['cmd']['type']['info']['subtype'][$cmd->getSubType()]['isHistorized']['canBeSmooth'] - && $cmd->getConfiguration('smooth', 0) > 0 + && $cmd->getConfiguration('history::smooth', config::byKey('history::smooth','core',0)) > 0 && $cmd->getConfiguration('historizeMode', 'none') != 'none' && $this->getValue() !== null ) { if ($this->getTableName() == 'history') { $time = strtotime($this->getDatetime()); - $time -= $time % $cmd->getConfiguration('smooth', 0); + $time -= $time % $cmd->getConfiguration('smooth', config::byKey('history::smooth','core',0)); if ($this->getValue() == 0) { - $this->setDatetime(date('Y-m-d H:i:00', $time + $cmd->getConfiguration('smooth', 0))); + $this->setDatetime(date('Y-m-d H:i:00', $time + $cmd->getConfiguration('smooth', config::byKey('history::smooth','core',0)))); $values = array( 'cmd_id' => $this->getCmd_id(), 'datetime' => date('Y-m-d H:i:00', strtotime($this->getDatetime())), diff --git a/core/config/default.config.ini b/core/config/default.config.ini index 7bafc45386..e9f68aa34f 100644 --- a/core/config/default.config.ini +++ b/core/config/default.config.ini @@ -69,6 +69,7 @@ historyArchiveTime = 2 historyArchivePackage = 1 displayStatsWidget = 0 history::defautShowPeriod = -1 month +history::smooth = 0 ;security security::maxFailedLogin = 6 diff --git a/desktop/modal/cmd.configure.php b/desktop/modal/cmd.configure.php index 6e432d9434..e85218ca1b 100644 --- a/desktop/modal/cmd.configure.php +++ b/desktop/modal/cmd.configure.php @@ -516,8 +516,9 @@
- + + diff --git a/desktop/php/administration.php b/desktop/php/administration.php index ea1fb1a0a3..505a5d6cb8 100644 --- a/desktop/php/administration.php +++ b/desktop/php/administration.php @@ -1170,6 +1170,19 @@
+
+ +
+ +
+
From 062629f68469db338ca7fc3865f6ccb97e0e7d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:05:38 +0200 Subject: [PATCH 07/11] #2610 --- core/config/default.config.ini | 2 +- desktop/php/administration.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/config/default.config.ini b/core/config/default.config.ini index e9f68aa34f..c65e263bb8 100644 --- a/core/config/default.config.ini +++ b/core/config/default.config.ini @@ -69,7 +69,7 @@ historyArchiveTime = 2 historyArchivePackage = 1 displayStatsWidget = 0 history::defautShowPeriod = -1 month -history::smooth = 0 +history::smooth = -2 ;security security::maxFailedLogin = 6 diff --git a/desktop/php/administration.php b/desktop/php/administration.php index 505a5d6cb8..3790841a7a 100644 --- a/desktop/php/administration.php +++ b/desktop/php/administration.php @@ -1176,7 +1176,7 @@
- + From c91cd5c0a74157f7debf42fb68258002e51a510e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:26:21 +0200 Subject: [PATCH 09/11] #2610 --- core/class/history.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/class/history.class.php b/core/class/history.class.php index 48e1872a8f..c1ed749631 100644 --- a/core/class/history.class.php +++ b/core/class/history.class.php @@ -1032,9 +1032,9 @@ public function save($_cmd = null, $_direct = false) { && $this->getValue() !== null ) { if ($this->getTableName() == 'history') { $time = strtotime($this->getDatetime()); - $time -= $time % $cmd->getConfiguration('smooth', config::byKey('history::smooth','core',0)); + $time -= $time % $cmd->getConfiguration('history::smooth', config::byKey('history::smooth','core',0)); if ($this->getValue() == 0) { - $this->setDatetime(date('Y-m-d H:i:00', $time + $cmd->getConfiguration('smooth', config::byKey('history::smooth','core',0)))); + $this->setDatetime(date('Y-m-d H:i:00', $time + $cmd->getConfiguration('history::smooth', config::byKey('history::smooth','core',0)))); $values = array( 'cmd_id' => $this->getCmd_id(), 'datetime' => date('Y-m-d H:i:00', strtotime($this->getDatetime())), From b773cddc5c41bbe694c0bfa917c096cb26e62bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:28:03 +0200 Subject: [PATCH 10/11] #2610 --- desktop/php/administration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/php/administration.php b/desktop/php/administration.php index b0aaabf7b9..7b4ae84935 100644 --- a/desktop/php/administration.php +++ b/desktop/php/administration.php @@ -1171,10 +1171,10 @@
-