Skip to content

Commit

Permalink
Merge branch 'jeedom:alpha' into fix/debug_traces
Browse files Browse the repository at this point in the history
  • Loading branch information
pifou25 authored May 26, 2024
2 parents 7a0cbbe + bac551f commit c5e58f7
Show file tree
Hide file tree
Showing 21 changed files with 286 additions and 158 deletions.
8 changes: 6 additions & 2 deletions core/ajax/cmd.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,12 @@
}

if (init('action') == 'byEqLogic') {
ajax::success(utils::o2a(cmd::byEqLogicId(init('eqLogic_id'))));
}
if (init('typeCmd')) {
ajax::success(utils::o2a(cmd::byEqLogicId(init('eqLogic_id'), init('typeCmd'))));
} else {
ajax::success(utils::o2a(cmd::byEqLogicId(init('eqLogic_id'))));
}
}

if (init('action') == 'getCmd') {
$cmd = cmd::byId(init('id'));
Expand Down
2 changes: 1 addition & 1 deletion core/ajax/jeedom.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
$cmd .= system::checkInstallationLog();
$cmd .= system::getCmdSudo() . " apt update\n";
$package = explode('::', init('package'));
$cmd .= system::installPackage($package[0], $package[1]) . "\n";
$cmd .= system::installPackage($package[0], $package[1], $package[3], $package[2]) . "\n";
if (file_exists('/tmp/jeedom_fix_package')) {
shell_exec(system::getCmdSudo() . ' rm /tmp/jeedom_fix_package');
}
Expand Down
12 changes: 6 additions & 6 deletions core/class/history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ public static function archive() {
DB::Prepare($sql, array());
$sql = 'DELETE FROM historyArch WHERE `value` IS NULL';
DB::Prepare($sql, array());
$sql = 'DELETE FROM history WHERE `datetime` <= "2000-01-01 01:00:00" OR `datetime` >= "2025-01-01 01:00:00"';
$sql = 'DELETE FROM history WHERE `datetime` <= "2000-01-01 01:00:00" OR `datetime` >= "2026-01-01 01:00:00"';
DB::Prepare($sql, array());
$sql = 'DELETE FROM historyArch WHERE `datetime` <= "2000-01-01 01:00:00" OR `datetime` >= "2025-01-01 01:00:00"';
$sql = 'DELETE FROM historyArch WHERE `datetime` <= "2000-01-01 01:00:00" OR `datetime` >= "2026-01-01 01:00:00"';
DB::Prepare($sql, array());
$sql = 'DELETE FROM history WHERE `value` IS NULL';
DB::Prepare($sql, array());
Expand Down Expand Up @@ -1026,12 +1026,12 @@ public function save($_cmd = null, $_direct = false) {
if ($cmd->getConfiguration('historizeRound') !== '' && is_numeric($cmd->getConfiguration('historizeRound')) && $cmd->getConfiguration('historizeRound') >= 0 && $this->getValue() !== null) {
$this->setValue(round($this->getValue(), $cmd->getConfiguration('historizeRound')));
}
/*if ($JEEDOM_INTERNAL_CONFIG['cmd']['type']['info']['subtype'][$cmd->getSubType()]['isHistorized']['canBeSmooth'] && $cmd->getConfiguration('historizeMode', 'avg') != 'none' && $this->getValue() !== null && $_direct === false) {
if ($JEEDOM_INTERNAL_CONFIG['cmd']['type']['info']['subtype'][$cmd->getSubType()]['isHistorized']['canBeSmooth'] && $cmd->getConfiguration('smooth', 0) > 0 && $cmd->getConfiguration('historizeMode', 'none') =! 'none' && $this->getValue() !== null) {
if ($this->getTableName() == 'history') {
$time = strtotime($this->getDatetime());
$time -= $time % 300;
$time -= $time % $cmd->getConfiguration('smooth', 0);
if ($this->getValue() == 0) {
$this->setDatetime(date('Y-m-d H:i:00', $time + 300));
$this->setDatetime(date('Y-m-d H:i:00', $time + $cmd->getConfiguration('smooth', 0)));
$values = array(
'cmd_id' => $this->getCmd_id(),
'datetime' => date('Y-m-d H:i:00', strtotime($this->getDatetime())),
Expand Down Expand Up @@ -1072,7 +1072,7 @@ public function save($_cmd = null, $_direct = false) {
}
}
}
}*/
}
$values = array(
'cmd_id' => $this->getCmd_id(),
'datetime' => $this->getDatetime(),
Expand Down
6 changes: 4 additions & 2 deletions core/class/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class plugin {
private $info = array();
private $include = array();
private $functionality = array();
private $usedSpace = 0;
private static $_cache = array();
private static $_enable = null;

Expand Down Expand Up @@ -152,6 +153,7 @@ public static function byId($_id) {
}
}
}
$plugin->usedSpace = getDirectorySize(__DIR__ . '/../../plugins/' . $data['id']);
self::$_cache[$plugin->id] = $plugin;
return $plugin;
}
Expand Down Expand Up @@ -669,7 +671,7 @@ public function dependancy_info($_refresh = false) {
}
if (file_exists(__DIR__ . '/../../plugins/' . $plugin_id . '/plugin_info/packages.json')) {
$return = array('log' => $plugin_id . '_packages');
$packages = system::checkAndInstall(json_decode(file_get_contents(__DIR__ . '/../../plugins/' . $plugin_id . '/plugin_info/packages.json'), true));
$packages = system::checkAndInstall(json_decode(file_get_contents(__DIR__ . '/../../plugins/' . $plugin_id . '/plugin_info/packages.json'), true), false, false, $plugin_id);
$has_dep_to_install = false;
foreach ($packages as $package => $info) {
if ($info['status'] != 0 || $info['optional']) {
Expand All @@ -694,7 +696,7 @@ public function dependancy_info($_refresh = false) {
}
$return['last_launch'] = config::byKey('lastDependancyInstallTime', $this->getId(), __('Inconnue', __FILE__));
$return['auto'] = config::byKey('dependancyAutoMode', $this->getId(), 1);
if (method_exists($plugin_id, 'additionnalDependancyCheck')) {
if ($return['state'] != 'in_progress' && method_exists($plugin_id, 'additionnalDependancyCheck')) {
$additionnal = $plugin_id::additionnalDependancyCheck();
if (isset($additionnal['state'])) {
$return['state'] = $additionnal['state'];
Expand Down
Loading

0 comments on commit c5e58f7

Please sign in to comment.