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); } } diff --git a/core/class/history.class.php b/core/class/history.class.php index 2b8b9b0606..c1ed749631 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('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', 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())), 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 '; diff --git a/core/config/default.config.ini b/core/config/default.config.ini index 7bafc45386..c65e263bb8 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 = -2 ;security security::maxFailedLogin = 6 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 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 @@