Skip to content

Commit 90a95f1

Browse files
authored
Merge pull request #2830 from jeedom/master
Last merge info v4 stable 4.4.12
2 parents e7524d0 + 9f916da commit 90a95f1

File tree

6 files changed

+31
-14
lines changed

6 files changed

+31
-14
lines changed

core/class/cache.class.php

+16-7
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public static function clean() {
299299
/* * *********************Methode d'instance************************* */
300300

301301
public function save() {
302-
$this->setDatetime(strtotime('now'));
302+
$this->setTimestamp(strtotime('now'));
303303
$engine = config::byKey('cache::engine');
304304
if(in_array($engine,array('MariadbCache','FileCache','RedisCache'))){
305305
return $engine::save($this);
@@ -355,11 +355,20 @@ public function setLifetime($lifetime): self {
355355
}
356356

357357
public function getDatetime() {
358-
return $this->datetime;
358+
return date('Y-m-d H:i:s',$this->datetime);
359359
}
360360

361361
public function setDatetime($datetime): self {
362-
$this->datetime = $datetime;
362+
$this->datetime = strtotime($datetime);
363+
return $this;
364+
}
365+
366+
public function getTimestamp(){
367+
return $this->datetime;
368+
}
369+
370+
public function setTimestamp($_timestamp){
371+
$this->datetime = $_timestamp;
363372
return $this;
364373
}
365374
}
@@ -392,7 +401,7 @@ public static function fetch($_key){
392401
if($cache === false){
393402
return null;
394403
}
395-
if($cache->getLifetime() > 0 && ($cache->getDatetime() + $cache->getLifetime()) < strtotime('now')){
404+
if($cache->getLifetime() > 0 && ($cache->getTimestamp() + $cache->getLifetime()) < strtotime('now')){
396405
return null;
397406
}
398407
$cache->setValue(unserialize($cache->getValue()));
@@ -415,7 +424,7 @@ public static function save($_cache){
415424
'key' => $_cache->getKey(),
416425
'value' => serialize($_cache->getValue()),
417426
'lifetime' =>$_cache->getLifetime(),
418-
'datetime' => $_cache->getDatetime()
427+
'datetime' => $_cache->getTimestamp()
419428
);
420429
$sql = 'REPLACE INTO cache SET `key`=:key, `value`=:value,`datetime`=:datetime,`lifetime`=:lifetime';
421430
return DB::Prepare($sql,$value, DB::FETCH_TYPE_ROW);
@@ -485,7 +494,7 @@ public static function all(){
485494
public static function clean(){
486495
foreach (ls(jeedom::getTmpFolder('cache'), '*',false,array('files')) as $file) {
487496
$cache = unserialize(file_get_contents(jeedom::getTmpFolder('cache').'/'.$file));
488-
if($cache->getLifetime() > 0 && ($cache->getDatetime() + $cache->getLifetime()) < strtotime('now')){
497+
if($cache->getLifetime() > 0 && ($cache->getTimestamp() + $cache->getLifetime()) < strtotime('now')){
489498
unlink(jeedom::getTmpFolder('cache').'/'.$file);
490499
}
491500
}
@@ -500,7 +509,7 @@ public static function fetch($_key){
500509
if(!is_object($cache)){
501510
return null;
502511
}
503-
if($cache->getLifetime() > 0 && ($cache->getDatetime() + $cache->getLifetime()) < strtotime('now')){
512+
if($cache->getLifetime() > 0 && ($cache->getTimestamp() + $cache->getLifetime()) < strtotime('now')){
504513
self::delete($_key);
505514
return null;
506515
}

core/class/event.class.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static function filterEvent($_events = array(), $_filter = null) {
126126
}
127127
$filters = ($_filter !== null) ? cache::byKey($_filter . '::event')->getValue(array()) : array();
128128
$return = array();
129-
foreach (_events as $event) {
129+
foreach ($_events as $event) {
130130
if ($_filter !== null && isset($_filter::$_listenEvents) && !in_array($event->getName(), $_filter::$_listenEvents)) {
131131
continue;
132132
}
@@ -181,6 +181,9 @@ public function setName($_name) {
181181
}
182182

183183
public function getOption($_key = '', $_default = '') {
184+
if(!is_json($this->option)){
185+
return $this->option;
186+
}
184187
return utils::getJsonAttr($this->option, $_key, $_default);
185188
}
186189

core/config/version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.4.10
1+
4.4.12

desktop/php/administration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
$cache = cache::byKey('hour');
261261
$lastKnowDate = $cache->getDatetime();
262262
?>
263-
<span class="label label-info"><?php echo date('Y-m-d H:i:s',(int) $lastKnowDate) ?></span>
263+
<span class="label label-info"><?php echo $lastKnowDate ?></span>
264264
<a class="btn btn-sm btn-default pull-right" id="bt_resetHour" tooltip="{{Remise à zéro}}"><i class=" fas fa-undo-alt"></i></a>
265265
</div>
266266
</div>

docs/fr_FR/changelog.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog Jeedom V4.4
22

3+
# 4.4.12
4+
5+
- Correction d'un bug sur la fonction de filtre des évenements (impact les plugins type homebridge) [LIEN](https://github.com/jeedom/core/commit/a7b6447bbd000b6508aebee211fb4b68be03ebe2)
6+
7+
# 4.4.11
8+
9+
- Correction d'un bug avec l'action gotodesign [LIEN](https://github.com/jeedom/core/issues/2825)
10+
- Correction de l'erreur sur certain plugin `Call to a member function getTimestamp()` [LIEN](https://github.com/jeedom/core/issues/2828)
11+
312
# 4.4.10
413

514
- Déplacement de la gestion des evenements (event) qui sert à la mise à jour de l'interface en base de données en mémoire [LIEN](https://github.com/jeedom/core/pull/2757)

install/database.json

-4
Original file line numberDiff line numberDiff line change
@@ -1083,10 +1083,6 @@
10831083
"3": {
10841084
"column": "event",
10851085
"Sub_part": null
1086-
},
1087-
"4": {
1088-
"column": "option",
1089-
"Sub_part": null
10901086
}
10911087
}
10921088
}

0 commit comments

Comments
 (0)