Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta 4.4.7 (again) #2669

Merged
merged 14 commits into from
Jun 4, 2024
13 changes: 11 additions & 2 deletions core/class/DB.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
6 changes: 3 additions & 3 deletions core/class/history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
Expand Down
5 changes: 1 addition & 4 deletions core/class/timeline.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ';
Expand Down
1 change: 1 addition & 0 deletions core/config/default.config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ historyArchiveTime = 2
historyArchivePackage = 1
displayStatsWidget = 0
history::defautShowPeriod = -1 month
history::smooth = -2

;security
security::maxFailedLogin = 6
Expand Down
1 change: 1 addition & 0 deletions desktop/js/plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions desktop/modal/cmd.configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,9 @@
<sup><i class="fas fa-question-circle" title="{{Limite le nombre de valeur historisé par la commande en temps réel (avant le lissage de la nuit). Attention un mode de lissage doit absolument être défini.}}"></i></sup>
</label>
<div class="col-sm-6">
<select class="form-control cmdAttr" data-l1key="configuration" data-l2key="smooth">
<option value="0">{{Aucun}}</option>
<select class="form-control cmdAttr" data-l1key="configuration" data-l2key="history::smooth">
<option value="">{{Default}}</option>
<option value="-1">{{Aucun}}</option>
<option value="60">{{1 min}}</option>
<option value="300">{{5 min}}</option>
<option value="600">{{10 min}}</option>
Expand Down
13 changes: 13 additions & 0 deletions desktop/php/administration.php
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,19 @@
<input type="text" class="configKey form-control" data-l1key="historyCalculTendanceThresholddMax">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 col-md-4 col-sm-6 col-xs-6 control-label">{{Limiter à une valeur toute les}}
<sup><i class="fas fa-question-circle" title="{{Limite le nombre de valeur historisé par les commandes en temps réel (avant le lissage de la nuit). Attention un mode de lissage doit absolument être défini.}}"></i></sup>
</label>
<div class="col-lg-2 col-md-2 col-sm-5 col-xs-6">
<select class="form-control configKey" data-l1key="history::smooth">
<option value="-2">{{Aucun}}</option>
<option value="60">{{1 min}}</option>
<option value="300">{{5 min}}</option>
<option value="600">{{10 min}}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 col-md-4 col-sm-6 col-xs-6 control-label">{{Période d'affichage des graphiques par défaut}}</label>
<div class="col-lg-2 col-md-2 col-sm-5 col-xs-6">
Expand Down
3 changes: 3 additions & 0 deletions docs/fr_FR/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
- Correction d'un bug sur la verfication de la base de données ou il pouvait toujours manquer un index [LIEN](https://github.com/jeedom/core/issues/2655)
- Correction d'un bug sur le graphique des liens [LIEN](https://github.com/jeedom/core/issues/2659)
- Suppression sur service worker en mobile (plus utilisé) [LIEN](https://github.com/jeedom/core/issues/2660)
- Correction d'un bug pouvant affecter la limitation du nombre d'evenement dans la timeline [LIEN](https://github.com/jeedom/core/issues/2663)
- Correction d'un bug sur l'affichage des tooltips sur les designs [LIEN](https://github.com/jeedom/core/pull/2667)
- Amélioration de la gestion des trace de PDO avec php8 [LIEN](https://github.com/jeedom/core/pull/2661)

# 4.4.6

Expand Down
2 changes: 1 addition & 1 deletion install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions install/restore.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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";
}
Expand Down
Loading