Skip to content

Commit 6edbb96

Browse files
authored
Merge pull request #1804 from jeedom/beta
Beta To Stable 4.1.19
2 parents 6a158d1 + fbf36bd commit 6edbb96

File tree

8 files changed

+191
-177
lines changed

8 files changed

+191
-177
lines changed

core/ajax/view.ajax.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
$view_ajax = json_decode(init('view'), true);
8181
utils::a2o($view, $view_ajax);
8282
$view->save();
83+
$view->removeviewZone();
8384
if (isset($view_ajax['zones']) && count($view_ajax['zones']) > 0) {
84-
$view->removeviewZone();
8585
foreach ($view_ajax['zones'] as $viewZone_info) {
8686
$viewZone = new viewZone();
8787
$viewZone->setView_id($view->getId());

core/class/jeedom.class.php

+143-139
Original file line numberDiff line numberDiff line change
@@ -1375,184 +1375,188 @@ public static function cleanDatabase() {
13751375
}
13761376

13771377
public static function cleanFileSytemRight() {
1378+
self::cleanFileSystemRight();
1379+
}
1380+
1381+
public static function cleanFileSystemRight() {
13781382
$cmd = system::getCmdSudo() . 'chown -R ' . system::get('www-uid') . ':' . system::get('www-gid') . ' ' . __DIR__ . '/../../*;';
13791383
$cmd .= system::getCmdSudo() . 'chmod 775 -R ' . __DIR__ . '/../../*;';
13801384
$cmd .= system::getCmdSudo() . 'find ' . __DIR__ . '/../../log -type f -exec chmod 665 {} +;';
1381-
$cmd .= system::getCmdSudo() . 'chmod 775 -R ' . __DIR__ . '/../../.* ;';
1382-
exec($cmd);
1383-
}
1385+
$cmd .= system::getCmdSudo() . 'chmod 775 -R ' . __DIR__ . '/../../.* ;';
1386+
exec($cmd);
1387+
}
13841388

1385-
public static function checkSpaceLeft($_dir = null) {
1386-
if ($_dir == null) {
1387-
$path = __DIR__ . '/../../';
1388-
} else {
1389-
$path = $_dir;
1390-
}
1391-
return round(disk_free_space($path) / disk_total_space($path) * 100);
1389+
public static function checkSpaceLeft($_dir = null) {
1390+
if ($_dir == null) {
1391+
$path = __DIR__ . '/../../';
1392+
} else {
1393+
$path = $_dir;
13921394
}
1395+
return round(disk_free_space($path) / disk_total_space($path) * 100);
1396+
}
13931397

1394-
public static function getTmpFolder($_plugin = null) {
1395-
$return = '/' . trim(config::byKey('folder::tmp'), '/');
1396-
if ($_plugin !== null) {
1397-
$return .= '/' . $_plugin;
1398-
}
1399-
if (!file_exists($return)) {
1400-
mkdir($return, 0774, true);
1401-
$cmd = system::getCmdSudo() . 'chown -R ' . system::get('www-uid') . ':' . system::get('www-gid') . ' ' . $return . ';';
1402-
com_shell::execute($cmd);
1403-
}
1404-
return $return;
1398+
public static function getTmpFolder($_plugin = null) {
1399+
$return = '/' . trim(config::byKey('folder::tmp'), '/');
1400+
if ($_plugin !== null) {
1401+
$return .= '/' . $_plugin;
1402+
}
1403+
if (!file_exists($return)) {
1404+
mkdir($return, 0774, true);
1405+
$cmd = system::getCmdSudo() . 'chown -R ' . system::get('www-uid') . ':' . system::get('www-gid') . ' ' . $return . ';';
1406+
com_shell::execute($cmd);
14051407
}
1408+
return $return;
1409+
}
14061410

1407-
/* * ******************hardware management*************************** */
1411+
/* * ******************hardware management*************************** */
14081412

1409-
public static function getHardwareKey() {
1410-
$return = config::byKey('jeedom::installKey');
1411-
if ($return == '') {
1412-
$return = substr(sha512(microtime() . config::genKey()), 0, 63);
1413-
config::save('jeedom::installKey', $return);
1414-
}
1415-
return $return;
1413+
public static function getHardwareKey() {
1414+
$return = config::byKey('jeedom::installKey');
1415+
if ($return == '') {
1416+
$return = substr(sha512(microtime() . config::genKey()), 0, 63);
1417+
config::save('jeedom::installKey', $return);
14161418
}
1419+
return $return;
1420+
}
14171421

1418-
public static function getHardwareName() {
1419-
if (config::byKey('hardware_name') != '') {
1420-
return config::byKey('hardware_name');
1421-
}
1422-
$result = 'diy';
1423-
$uname = shell_exec('uname -a');
1424-
if (file_exists('/.dockerinit')) {
1425-
$result = 'docker';
1426-
} else if (file_exists('/usr/bin/raspi-config')) {
1427-
$result = 'rpi';
1428-
$hardware_revision = strtolower(shell_exec('cat /proc/cpuinfo | grep Revision'));
1429-
global $JEEDOM_RPI_HARDWARE;
1430-
foreach ($JEEDOM_RPI_HARDWARE as $key => $values) {
1431-
foreach ($values as $value) {
1432-
if(strpos($hardware_revision,$value) !== false){
1433-
$result = $key;
1434-
}
1422+
public static function getHardwareName() {
1423+
if (config::byKey('hardware_name') != '') {
1424+
return config::byKey('hardware_name');
1425+
}
1426+
$result = 'diy';
1427+
$uname = shell_exec('uname -a');
1428+
if (file_exists('/.dockerinit')) {
1429+
$result = 'docker';
1430+
} else if (file_exists('/usr/bin/raspi-config')) {
1431+
$result = 'rpi';
1432+
$hardware_revision = strtolower(shell_exec('cat /proc/cpuinfo | grep Revision'));
1433+
global $JEEDOM_RPI_HARDWARE;
1434+
foreach ($JEEDOM_RPI_HARDWARE as $key => $values) {
1435+
foreach ($values as $value) {
1436+
if(strpos($hardware_revision,$value) !== false){
1437+
$result = $key;
14351438
}
14361439
}
1437-
} else if (strpos($uname, 'cubox') !== false || strpos($uname, 'imx6') !== false || file_exists('/media/boot/multiboot/meson64_odroidc2.dtb.linux')) {
1438-
$result = 'miniplus';
1439-
} else if (file_exists('/usr/bin/grille-pain')) {
1440-
$result = 'freeboxDelta';
14411440
}
1442-
if (file_exists('/media/boot/multiboot/meson64_odroidc2.dtb.linux')) {
1443-
$result = 'smart';
1444-
}
1445-
config::save('hardware_name', $result);
1446-
return config::byKey('hardware_name');
1441+
} else if (strpos($uname, 'cubox') !== false || strpos($uname, 'imx6') !== false || file_exists('/media/boot/multiboot/meson64_odroidc2.dtb.linux')) {
1442+
$result = 'miniplus';
1443+
} else if (file_exists('/usr/bin/grille-pain')) {
1444+
$result = 'freeboxDelta';
14471445
}
1446+
if (file_exists('/media/boot/multiboot/meson64_odroidc2.dtb.linux')) {
1447+
$result = 'smart';
1448+
}
1449+
config::save('hardware_name', $result);
1450+
return config::byKey('hardware_name');
1451+
}
14481452

1449-
public static function isCapable($_function, $_forceRefresh = false) {
1450-
global $JEEDOM_COMPATIBILIY_CONFIG;
1451-
if ($_function == 'sudo') {
1452-
if (!$_forceRefresh) {
1453-
$cache = cache::byKey('jeedom::isCapable::sudo');
1454-
if ($cache->getValue(0) == 1) {
1455-
return true;
1456-
}
1453+
public static function isCapable($_function, $_forceRefresh = false) {
1454+
global $JEEDOM_COMPATIBILIY_CONFIG;
1455+
if ($_function == 'sudo') {
1456+
if (!$_forceRefresh) {
1457+
$cache = cache::byKey('jeedom::isCapable::sudo');
1458+
if ($cache->getValue(0) == 1) {
1459+
return true;
14571460
}
1458-
$result = (shell_exec('sudo -l > /dev/null 2>&1; echo $?') == 0) ? true : false;
1459-
cache::set('jeedom::isCapable::sudo', $result,3600*24);
1460-
return $result;
1461-
}
1462-
$hardware = self::getHardwareName();
1463-
if (!isset($JEEDOM_COMPATIBILIY_CONFIG[$hardware])) {
1464-
return false;
1465-
}
1466-
if (in_array($_function, $JEEDOM_COMPATIBILIY_CONFIG[$hardware])) {
1467-
return true;
14681461
}
1462+
$result = (shell_exec('sudo -l > /dev/null 2>&1; echo $?') == 0) ? true : false;
1463+
cache::set('jeedom::isCapable::sudo', $result,3600*24);
1464+
return $result;
1465+
}
1466+
$hardware = self::getHardwareName();
1467+
if (!isset($JEEDOM_COMPATIBILIY_CONFIG[$hardware])) {
14691468
return false;
14701469
}
1470+
if (in_array($_function, $JEEDOM_COMPATIBILIY_CONFIG[$hardware])) {
1471+
return true;
1472+
}
1473+
return false;
1474+
}
14711475

1472-
/* * ******************Benchmark*************************** */
1473-
1474-
public static function benchmark() {
1475-
$return = array();
1476+
/* * ******************Benchmark*************************** */
14761477

1477-
$param = array('cache_write' => 5000, 'cache_read' => 5000, 'database_write_delete' => 1000, 'database_update' => 1000, 'database_replace' => 1000, 'database_read' => 50000, 'subprocess' => 200);
1478+
public static function benchmark() {
1479+
$return = array();
14781480

1479-
$starttime = getmicrotime();
1480-
for ($i = 0; $i < $param['cache_write']; $i++) {
1481-
cache::set('jeedom_benchmark', $i);
1482-
}
1483-
$return['cache_write_' . $param['cache_write']] = getmicrotime() - $starttime;
1481+
$param = array('cache_write' => 5000, 'cache_read' => 5000, 'database_write_delete' => 1000, 'database_update' => 1000, 'database_replace' => 1000, 'database_read' => 50000, 'subprocess' => 200);
14841482

1485-
$starttime = getmicrotime();
1486-
for ($i = 0; $i < $param['cache_read']; $i++) {
1487-
$cache = cache::byKey('jeedom_benchmark');
1488-
$cache->getValue();
1489-
}
1490-
$return['cache_read_' . $param['cache_read']] = getmicrotime() - $starttime;
1483+
$starttime = getmicrotime();
1484+
for ($i = 0; $i < $param['cache_write']; $i++) {
1485+
cache::set('jeedom_benchmark', $i);
1486+
}
1487+
$return['cache_write_' . $param['cache_write']] = getmicrotime() - $starttime;
14911488

1492-
$starttime = getmicrotime();
1493-
for ($i = 0; $i < $param['database_write_delete']; $i++) {
1494-
$sql = 'DELETE FROM config
1495-
WHERE `key`="jeedom_benchmark"
1496-
AND plugin="core"';
1497-
try {
1498-
DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW);
1499-
} catch (Exception $e) {
1489+
$starttime = getmicrotime();
1490+
for ($i = 0; $i < $param['cache_read']; $i++) {
1491+
$cache = cache::byKey('jeedom_benchmark');
1492+
$cache->getValue();
1493+
}
1494+
$return['cache_read_' . $param['cache_read']] = getmicrotime() - $starttime;
15001495

1501-
}
1502-
$sql = 'INSERT INTO config
1503-
SET `key`="jeedom_benchmark",plugin="core",`value`="' . $i . '"';
1504-
try {
1505-
DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW);
1506-
} catch (Exception $e) {
1496+
$starttime = getmicrotime();
1497+
for ($i = 0; $i < $param['database_write_delete']; $i++) {
1498+
$sql = 'DELETE FROM config
1499+
WHERE `key`="jeedom_benchmark"
1500+
AND plugin="core"';
1501+
try {
1502+
DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW);
1503+
} catch (Exception $e) {
15071504

1508-
}
15091505
}
1510-
$return['database_write_delete_' . $param['database_write_delete']] = getmicrotime() - $starttime;
1511-
15121506
$sql = 'INSERT INTO config
1513-
SET `key`="jeedom_benchmark",plugin="core",`value`="0"';
1507+
SET `key`="jeedom_benchmark",plugin="core",`value`="' . $i . '"';
15141508
try {
15151509
DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW);
15161510
} catch (Exception $e) {
15171511

15181512
}
1519-
$starttime = getmicrotime();
1520-
for ($i = 0; $i < $param['database_update']; $i++) {
1521-
$sql = 'UPDATE config
1522-
SET `value`=:value
1523-
WHERE `key`="jeedom_benchmark"
1524-
AND plugin="core"';
1525-
try {
1526-
DB::Prepare($sql, array('value' => $i), DB::FETCH_TYPE_ROW);
1527-
} catch (Exception $e) {
1513+
}
1514+
$return['database_write_delete_' . $param['database_write_delete']] = getmicrotime() - $starttime;
15281515

1529-
}
1530-
}
1531-
$return['database_update_' . $param['database_update']] = getmicrotime() - $starttime;
1516+
$sql = 'INSERT INTO config
1517+
SET `key`="jeedom_benchmark",plugin="core",`value`="0"';
1518+
try {
1519+
DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW);
1520+
} catch (Exception $e) {
15321521

1533-
$starttime = getmicrotime();
1534-
for ($i = 0; $i < $param['database_replace']; $i++) {
1535-
config::save('jeedom_benchmark', $i);
1536-
}
1537-
$return['database_replace_' . $param['database_replace']] = getmicrotime() - $starttime;
1522+
}
1523+
$starttime = getmicrotime();
1524+
for ($i = 0; $i < $param['database_update']; $i++) {
1525+
$sql = 'UPDATE config
1526+
SET `value`=:value
1527+
WHERE `key`="jeedom_benchmark"
1528+
AND plugin="core"';
1529+
try {
1530+
DB::Prepare($sql, array('value' => $i), DB::FETCH_TYPE_ROW);
1531+
} catch (Exception $e) {
15381532

1539-
$starttime = getmicrotime();
1540-
for ($i = 0; $i < $param['database_read']; $i++) {
1541-
config::byKey('jeedom_benchmark');
15421533
}
1543-
$return['database_read_' . $param['database_read']] = getmicrotime() - $starttime;
1534+
}
1535+
$return['database_update_' . $param['database_update']] = getmicrotime() - $starttime;
15441536

1545-
$starttime = getmicrotime();
1546-
for ($i = 0; $i < $param['subprocess']; $i++) {
1547-
shell_exec('echo ' . $i);
1548-
}
1549-
$return['subprocess_' . $param['subprocess']] = getmicrotime() - $starttime;
1537+
$starttime = getmicrotime();
1538+
for ($i = 0; $i < $param['database_replace']; $i++) {
1539+
config::save('jeedom_benchmark', $i);
1540+
}
1541+
$return['database_replace_' . $param['database_replace']] = getmicrotime() - $starttime;
15501542

1551-
$total = 0;
1552-
foreach ($return as $value) {
1553-
$total += $value;
1554-
}
1555-
$return['total'] = $total;
1556-
return $return;
1543+
$starttime = getmicrotime();
1544+
for ($i = 0; $i < $param['database_read']; $i++) {
1545+
config::byKey('jeedom_benchmark');
15571546
}
1547+
$return['database_read_' . $param['database_read']] = getmicrotime() - $starttime;
1548+
1549+
$starttime = getmicrotime();
1550+
for ($i = 0; $i < $param['subprocess']; $i++) {
1551+
shell_exec('echo ' . $i);
1552+
}
1553+
$return['subprocess_' . $param['subprocess']] = getmicrotime() - $starttime;
1554+
1555+
$total = 0;
1556+
foreach ($return as $value) {
1557+
$total += $value;
1558+
}
1559+
$return['total'] = $total;
1560+
return $return;
15581561
}
1562+
}

core/config/jeedom.config.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@
297297
'MEDIA_RESUME' => array('name' => __('Lecture',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'),
298298
'MEDIA_STOP' => array('name' => __('Stop',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'),
299299
'MEDIA_NEXT' => array('name' => __('Suivant',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'),
300-
'MEDIA_PREVIOUS' => array('name' => __('Précedent',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'),
300+
'MEDIA_PREVIOUS' => array('name' => __('Précédent',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'),
301301
'MEDIA_ON' => array('name' => __('On',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true),
302-
'MEDIA_OFF' => array('name' => __('On',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true),
302+
'MEDIA_OFF' => array('name' => __('Off',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true),
303303
'MEDIA_MUTE' => array('name' => __('Muet',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true),
304304
'MEDIA_UNMUTE' => array('name' => __('Non Muet',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true),
305305
'GENERIC_INFO' => array('name' => __(' Générique',__FILE__), 'family' => __('Generic',__FILE__), 'type' => 'Info'),

core/config/version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1.18
1+
4.1.19

core/template/dashboard/cmd.info.numeric.default.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<script>
1212
jeedom.cmd.update['#id#'] = function(_options) {
1313
$('.cmd[data-cmd_id=#id#]').attr('title','{{Date de valeur}} : '+_options.valueDate+'<br/>{{Date de collecte}} : '+_options.collectDate)
14-
$('.cmd[data-cmd_uid=#uid#] .gauge').highcharts().series[0].points[0].update(_options.display_value)
14+
if ($('.cmd[data-cmd_uid=#uid#] .gauge').highcharts() !== undefined) {
15+
$('.cmd[data-cmd_uid=#uid#] .gauge').highcharts().series[0].points[0].update(_options.display_value)
16+
}
1517
}
1618

1719
if (is_numeric('#state#')) {

desktop/common/js/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ function initPage() {
704704

705705
try {
706706
if (getDeviceType()['type'] == 'desktop') $("input[id^='in_search']").first().focus()
707-
} catch {}
707+
} catch (error) {}
708708
}
709709

710710
var __OBSERVER__ = null

docs/fr_FR/changelog.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog Jeedom V4.1
22

3+
4+
## 4.1.19
5+
6+
- Bugfix suppression de zone sur une Vue.
7+
- Bugfix erreur js pouvant apparaitre sur d'anciens navigateurs.
8+
- Bugfix cmd.info.numeric.default.html si commande non visible.
9+
- Bugfix page de connection.
10+
311
## 4.1.18
412

513
- Bugfix historiques sur les Designs.

0 commit comments

Comments
 (0)