diff --git a/core/ajax/view.ajax.php b/core/ajax/view.ajax.php index 33ad8204d8..6d337d7d98 100644 --- a/core/ajax/view.ajax.php +++ b/core/ajax/view.ajax.php @@ -80,8 +80,8 @@ $view_ajax = json_decode(init('view'), true); utils::a2o($view, $view_ajax); $view->save(); + $view->removeviewZone(); if (isset($view_ajax['zones']) && count($view_ajax['zones']) > 0) { - $view->removeviewZone(); foreach ($view_ajax['zones'] as $viewZone_info) { $viewZone = new viewZone(); $viewZone->setView_id($view->getId()); diff --git a/core/class/jeedom.class.php b/core/class/jeedom.class.php index 14ff6f6bf2..d0ca64df03 100644 --- a/core/class/jeedom.class.php +++ b/core/class/jeedom.class.php @@ -1375,184 +1375,188 @@ public static function cleanDatabase() { } public static function cleanFileSytemRight() { + self::cleanFileSystemRight(); + } + + public static function cleanFileSystemRight() { $cmd = system::getCmdSudo() . 'chown -R ' . system::get('www-uid') . ':' . system::get('www-gid') . ' ' . __DIR__ . '/../../*;'; $cmd .= system::getCmdSudo() . 'chmod 775 -R ' . __DIR__ . '/../../*;'; $cmd .= system::getCmdSudo() . 'find ' . __DIR__ . '/../../log -type f -exec chmod 665 {} +;'; - $cmd .= system::getCmdSudo() . 'chmod 775 -R ' . __DIR__ . '/../../.* ;'; - exec($cmd); - } + $cmd .= system::getCmdSudo() . 'chmod 775 -R ' . __DIR__ . '/../../.* ;'; + exec($cmd); + } - public static function checkSpaceLeft($_dir = null) { - if ($_dir == null) { - $path = __DIR__ . '/../../'; - } else { - $path = $_dir; - } - return round(disk_free_space($path) / disk_total_space($path) * 100); + public static function checkSpaceLeft($_dir = null) { + if ($_dir == null) { + $path = __DIR__ . '/../../'; + } else { + $path = $_dir; } + return round(disk_free_space($path) / disk_total_space($path) * 100); + } - public static function getTmpFolder($_plugin = null) { - $return = '/' . trim(config::byKey('folder::tmp'), '/'); - if ($_plugin !== null) { - $return .= '/' . $_plugin; - } - if (!file_exists($return)) { - mkdir($return, 0774, true); - $cmd = system::getCmdSudo() . 'chown -R ' . system::get('www-uid') . ':' . system::get('www-gid') . ' ' . $return . ';'; - com_shell::execute($cmd); - } - return $return; + public static function getTmpFolder($_plugin = null) { + $return = '/' . trim(config::byKey('folder::tmp'), '/'); + if ($_plugin !== null) { + $return .= '/' . $_plugin; + } + if (!file_exists($return)) { + mkdir($return, 0774, true); + $cmd = system::getCmdSudo() . 'chown -R ' . system::get('www-uid') . ':' . system::get('www-gid') . ' ' . $return . ';'; + com_shell::execute($cmd); } + return $return; + } - /* * ******************hardware management*************************** */ + /* * ******************hardware management*************************** */ - public static function getHardwareKey() { - $return = config::byKey('jeedom::installKey'); - if ($return == '') { - $return = substr(sha512(microtime() . config::genKey()), 0, 63); - config::save('jeedom::installKey', $return); - } - return $return; + public static function getHardwareKey() { + $return = config::byKey('jeedom::installKey'); + if ($return == '') { + $return = substr(sha512(microtime() . config::genKey()), 0, 63); + config::save('jeedom::installKey', $return); } + return $return; + } - public static function getHardwareName() { - if (config::byKey('hardware_name') != '') { - return config::byKey('hardware_name'); - } - $result = 'diy'; - $uname = shell_exec('uname -a'); - if (file_exists('/.dockerinit')) { - $result = 'docker'; - } else if (file_exists('/usr/bin/raspi-config')) { - $result = 'rpi'; - $hardware_revision = strtolower(shell_exec('cat /proc/cpuinfo | grep Revision')); - global $JEEDOM_RPI_HARDWARE; - foreach ($JEEDOM_RPI_HARDWARE as $key => $values) { - foreach ($values as $value) { - if(strpos($hardware_revision,$value) !== false){ - $result = $key; - } + public static function getHardwareName() { + if (config::byKey('hardware_name') != '') { + return config::byKey('hardware_name'); + } + $result = 'diy'; + $uname = shell_exec('uname -a'); + if (file_exists('/.dockerinit')) { + $result = 'docker'; + } else if (file_exists('/usr/bin/raspi-config')) { + $result = 'rpi'; + $hardware_revision = strtolower(shell_exec('cat /proc/cpuinfo | grep Revision')); + global $JEEDOM_RPI_HARDWARE; + foreach ($JEEDOM_RPI_HARDWARE as $key => $values) { + foreach ($values as $value) { + if(strpos($hardware_revision,$value) !== false){ + $result = $key; } } - } else if (strpos($uname, 'cubox') !== false || strpos($uname, 'imx6') !== false || file_exists('/media/boot/multiboot/meson64_odroidc2.dtb.linux')) { - $result = 'miniplus'; - } else if (file_exists('/usr/bin/grille-pain')) { - $result = 'freeboxDelta'; } - if (file_exists('/media/boot/multiboot/meson64_odroidc2.dtb.linux')) { - $result = 'smart'; - } - config::save('hardware_name', $result); - return config::byKey('hardware_name'); + } else if (strpos($uname, 'cubox') !== false || strpos($uname, 'imx6') !== false || file_exists('/media/boot/multiboot/meson64_odroidc2.dtb.linux')) { + $result = 'miniplus'; + } else if (file_exists('/usr/bin/grille-pain')) { + $result = 'freeboxDelta'; } + if (file_exists('/media/boot/multiboot/meson64_odroidc2.dtb.linux')) { + $result = 'smart'; + } + config::save('hardware_name', $result); + return config::byKey('hardware_name'); + } - public static function isCapable($_function, $_forceRefresh = false) { - global $JEEDOM_COMPATIBILIY_CONFIG; - if ($_function == 'sudo') { - if (!$_forceRefresh) { - $cache = cache::byKey('jeedom::isCapable::sudo'); - if ($cache->getValue(0) == 1) { - return true; - } + public static function isCapable($_function, $_forceRefresh = false) { + global $JEEDOM_COMPATIBILIY_CONFIG; + if ($_function == 'sudo') { + if (!$_forceRefresh) { + $cache = cache::byKey('jeedom::isCapable::sudo'); + if ($cache->getValue(0) == 1) { + return true; } - $result = (shell_exec('sudo -l > /dev/null 2>&1; echo $?') == 0) ? true : false; - cache::set('jeedom::isCapable::sudo', $result,3600*24); - return $result; - } - $hardware = self::getHardwareName(); - if (!isset($JEEDOM_COMPATIBILIY_CONFIG[$hardware])) { - return false; - } - if (in_array($_function, $JEEDOM_COMPATIBILIY_CONFIG[$hardware])) { - return true; } + $result = (shell_exec('sudo -l > /dev/null 2>&1; echo $?') == 0) ? true : false; + cache::set('jeedom::isCapable::sudo', $result,3600*24); + return $result; + } + $hardware = self::getHardwareName(); + if (!isset($JEEDOM_COMPATIBILIY_CONFIG[$hardware])) { return false; } + if (in_array($_function, $JEEDOM_COMPATIBILIY_CONFIG[$hardware])) { + return true; + } + return false; + } - /* * ******************Benchmark*************************** */ - - public static function benchmark() { - $return = array(); + /* * ******************Benchmark*************************** */ - $param = array('cache_write' => 5000, 'cache_read' => 5000, 'database_write_delete' => 1000, 'database_update' => 1000, 'database_replace' => 1000, 'database_read' => 50000, 'subprocess' => 200); + public static function benchmark() { + $return = array(); - $starttime = getmicrotime(); - for ($i = 0; $i < $param['cache_write']; $i++) { - cache::set('jeedom_benchmark', $i); - } - $return['cache_write_' . $param['cache_write']] = getmicrotime() - $starttime; + $param = array('cache_write' => 5000, 'cache_read' => 5000, 'database_write_delete' => 1000, 'database_update' => 1000, 'database_replace' => 1000, 'database_read' => 50000, 'subprocess' => 200); - $starttime = getmicrotime(); - for ($i = 0; $i < $param['cache_read']; $i++) { - $cache = cache::byKey('jeedom_benchmark'); - $cache->getValue(); - } - $return['cache_read_' . $param['cache_read']] = getmicrotime() - $starttime; + $starttime = getmicrotime(); + for ($i = 0; $i < $param['cache_write']; $i++) { + cache::set('jeedom_benchmark', $i); + } + $return['cache_write_' . $param['cache_write']] = getmicrotime() - $starttime; - $starttime = getmicrotime(); - for ($i = 0; $i < $param['database_write_delete']; $i++) { - $sql = 'DELETE FROM config - WHERE `key`="jeedom_benchmark" - AND plugin="core"'; - try { - DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW); - } catch (Exception $e) { + $starttime = getmicrotime(); + for ($i = 0; $i < $param['cache_read']; $i++) { + $cache = cache::byKey('jeedom_benchmark'); + $cache->getValue(); + } + $return['cache_read_' . $param['cache_read']] = getmicrotime() - $starttime; - } - $sql = 'INSERT INTO config - SET `key`="jeedom_benchmark",plugin="core",`value`="' . $i . '"'; - try { - DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW); - } catch (Exception $e) { + $starttime = getmicrotime(); + for ($i = 0; $i < $param['database_write_delete']; $i++) { + $sql = 'DELETE FROM config + WHERE `key`="jeedom_benchmark" + AND plugin="core"'; + try { + DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW); + } catch (Exception $e) { - } } - $return['database_write_delete_' . $param['database_write_delete']] = getmicrotime() - $starttime; - $sql = 'INSERT INTO config - SET `key`="jeedom_benchmark",plugin="core",`value`="0"'; + SET `key`="jeedom_benchmark",plugin="core",`value`="' . $i . '"'; try { DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW); } catch (Exception $e) { } - $starttime = getmicrotime(); - for ($i = 0; $i < $param['database_update']; $i++) { - $sql = 'UPDATE config - SET `value`=:value - WHERE `key`="jeedom_benchmark" - AND plugin="core"'; - try { - DB::Prepare($sql, array('value' => $i), DB::FETCH_TYPE_ROW); - } catch (Exception $e) { + } + $return['database_write_delete_' . $param['database_write_delete']] = getmicrotime() - $starttime; - } - } - $return['database_update_' . $param['database_update']] = getmicrotime() - $starttime; + $sql = 'INSERT INTO config + SET `key`="jeedom_benchmark",plugin="core",`value`="0"'; + try { + DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW); + } catch (Exception $e) { - $starttime = getmicrotime(); - for ($i = 0; $i < $param['database_replace']; $i++) { - config::save('jeedom_benchmark', $i); - } - $return['database_replace_' . $param['database_replace']] = getmicrotime() - $starttime; + } + $starttime = getmicrotime(); + for ($i = 0; $i < $param['database_update']; $i++) { + $sql = 'UPDATE config + SET `value`=:value + WHERE `key`="jeedom_benchmark" + AND plugin="core"'; + try { + DB::Prepare($sql, array('value' => $i), DB::FETCH_TYPE_ROW); + } catch (Exception $e) { - $starttime = getmicrotime(); - for ($i = 0; $i < $param['database_read']; $i++) { - config::byKey('jeedom_benchmark'); } - $return['database_read_' . $param['database_read']] = getmicrotime() - $starttime; + } + $return['database_update_' . $param['database_update']] = getmicrotime() - $starttime; - $starttime = getmicrotime(); - for ($i = 0; $i < $param['subprocess']; $i++) { - shell_exec('echo ' . $i); - } - $return['subprocess_' . $param['subprocess']] = getmicrotime() - $starttime; + $starttime = getmicrotime(); + for ($i = 0; $i < $param['database_replace']; $i++) { + config::save('jeedom_benchmark', $i); + } + $return['database_replace_' . $param['database_replace']] = getmicrotime() - $starttime; - $total = 0; - foreach ($return as $value) { - $total += $value; - } - $return['total'] = $total; - return $return; + $starttime = getmicrotime(); + for ($i = 0; $i < $param['database_read']; $i++) { + config::byKey('jeedom_benchmark'); } + $return['database_read_' . $param['database_read']] = getmicrotime() - $starttime; + + $starttime = getmicrotime(); + for ($i = 0; $i < $param['subprocess']; $i++) { + shell_exec('echo ' . $i); + } + $return['subprocess_' . $param['subprocess']] = getmicrotime() - $starttime; + + $total = 0; + foreach ($return as $value) { + $total += $value; + } + $return['total'] = $total; + return $return; } +} diff --git a/core/config/jeedom.config.php b/core/config/jeedom.config.php index d3ba50b3b5..5c0e48ef60 100644 --- a/core/config/jeedom.config.php +++ b/core/config/jeedom.config.php @@ -297,9 +297,9 @@ 'MEDIA_RESUME' => array('name' => __('Lecture',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'), 'MEDIA_STOP' => array('name' => __('Stop',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'), 'MEDIA_NEXT' => array('name' => __('Suivant',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'), - 'MEDIA_PREVIOUS' => array('name' => __('Précedent',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'), + 'MEDIA_PREVIOUS' => array('name' => __('Précédent',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action'), 'MEDIA_ON' => array('name' => __('On',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true), - 'MEDIA_OFF' => array('name' => __('On',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true), + 'MEDIA_OFF' => array('name' => __('Off',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true), 'MEDIA_MUTE' => array('name' => __('Muet',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true), 'MEDIA_UNMUTE' => array('name' => __('Non Muet',__FILE__), 'family' => __('Multimédia',__FILE__), 'type' => 'Action', 'noapp' => true), 'GENERIC_INFO' => array('name' => __(' Générique',__FILE__), 'family' => __('Generic',__FILE__), 'type' => 'Info'), diff --git a/core/config/version b/core/config/version index 60623b5c5f..3cee4a07ae 100644 --- a/core/config/version +++ b/core/config/version @@ -1 +1 @@ -4.1.18 +4.1.19 diff --git a/core/template/dashboard/cmd.info.numeric.default.html b/core/template/dashboard/cmd.info.numeric.default.html index 4bb8d995c4..134fa68c10 100644 --- a/core/template/dashboard/cmd.info.numeric.default.html +++ b/core/template/dashboard/cmd.info.numeric.default.html @@ -11,7 +11,9 @@