Skip to content

Commit

Permalink
Merge pull request #2572 from jeedom/beta
Browse files Browse the repository at this point in the history
Stable 4.4.5
  • Loading branch information
zoic21 authored Apr 25, 2024
2 parents afc94d4 + d39b7f1 commit 864afc8
Show file tree
Hide file tree
Showing 48 changed files with 269 additions and 128 deletions.
3 changes: 3 additions & 0 deletions core/ajax/repo.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
if (!is_object($update)) {
$update = new update();
}
if ($update->getConfiguration('doNotUpdate') == 1) {
throw new Exception(__('Mise à jour et réinstallation désactivées sur ', __FILE__) . ' ' . $repo->getLogicalId());
}
$update->setSource(init('repo'));
$update->setLogicalId($repo->getLogicalId());
$update->setType($repo->getType());
Expand Down
3 changes: 2 additions & 1 deletion core/class/cmd.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ public function actionAlertLevel($_level, $_value) {
}
}
} elseif ($this->getConfiguration('alert::messageReturnBack') == 1) {
$message = __('Retour à la normal de ', __FILE__) . ' ' . $this->getHumanName() . ' ' . __('valeur :', __FILE__) . ' ' . $_value . trim(' ' . $this->getUnite());
$message = __('Retour à la normale de ', __FILE__) . ' ' . $this->getHumanName() . ' ' . __('valeur :', __FILE__) . ' ' . $_value . trim(' ' . $this->getUnite());
log::add('event', 'info', $message);
$action = '<a href="/' . $this->getEqLogic()->getLinkToConfiguration() . '">' . __('Equipement', __FILE__) . '</a>';
message::add($this->getEqLogic()->getEqType_name(), $message, $action, 'alertReturnBack_' . $this->getId() . '_' . strtotime('now') . '_' . rand(0, 999), true, 'alertingReturnBack');
Expand Down Expand Up @@ -2956,6 +2956,7 @@ public function setId($_id = '') {
*/
public function setName($_name) {
$_name = substr(cleanComponanteName($_name), 0, 127);
$_name = trim($_name);
if ($this->name != $_name) {
$this->_needRefreshWidget = true;
$this->_changed = true;
Expand Down
1 change: 1 addition & 0 deletions core/class/eqLogic.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,7 @@ public function setId($_id) {

public function setName($_name) {
$_name = substr(cleanComponanteName($_name), 0, 127);
$_name = trim($_name);
if ($_name != $this->name) {
$this->_needRefreshWidget = true;
$this->_changed = true;
Expand Down
1 change: 1 addition & 0 deletions core/class/interactDef.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ public function getName() {
}

public function setName($_name) {
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed, $this->name, $_name);
$this->name = $_name;
return $this;
Expand Down
5 changes: 3 additions & 2 deletions core/class/jeeObject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1267,14 +1267,14 @@ public function getName() {
}

public function getFather_id($_default = null) {
if ($this->father_id == '' || !is_numeric($this->father_id)) {
if (!is_numeric($this->father_id)) {
return $_default;
}
return $this->father_id;
}

public function getIsVisible($_default = null) {
if ($this->isVisible == '' || !is_numeric($this->isVisible)) {
if (!is_numeric($this->isVisible)) {
return $_default;
}
return $this->isVisible;
Expand All @@ -1288,6 +1288,7 @@ public function setId($_id) {

public function setName($_name) {
$_name = substr(cleanComponanteName($_name), 0, 127);
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed, $this->name, $_name);
$this->name = $_name;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion core/class/jeedom.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public static function health() {

$apaches = count(system::ps('apache2'));
$return[] = array(
'name' => __('Apache', __FILE__),
'name' => __('Nombre de processus Apache', __FILE__),
'state' => ($apaches > 0),
'result' => $apaches,
'comment' => '',
Expand Down
8 changes: 6 additions & 2 deletions core/class/log.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ public static function get($_log, $_begin, $_nbLines) {
* @param int $_colored Should lines be colored (default false)
* @param boolean $_numbered Should lines be numbered (default true)
* @param int $_numStart At what number should lines number start (default 0)
* @param int $_max Max number of returned lines (default 4000)
* @param int $_max Max number of returned lines (default is config value "maxLineLog")
* @return array Array containing log to append to buffer and new position for next call
*/
public static function getDelta($_log = 'core', $_position = 0, $_search = '', $_colored = false, $_numbered = true, $_numStart = 0, $_max = 4000) {
public static function getDelta($_log = 'core', $_position = 0, $_search = '', $_colored = false, $_numbered = true, $_numStart = 0, $_max = -1) {
// Add path to file if needed
$filename = (file_exists($_log) && is_file($_log)) ? $_log : self::getPathToLog($_log);
// Check if log file exists and is readable
Expand Down Expand Up @@ -326,6 +326,10 @@ public static function getDelta($_log = 'core', $_position = 0, $_search = '', $
if ($nbLogs == 0) {
return array('position' => $_position, 'line' => $_numStart, 'logText' => $logText);
}
// $_max default value is configured value of "maxLineLog"
$_max = ($_max < 0) ? self::getConfig('maxLineLog') : $_max;
// $_max value is always more than DEFAULT_MAX_LINE
$_max = max($_max, self::DEFAULT_MAX_LINE);
if ($nbLogs > $_max) {
// If logs must be TRUNCATED, then add a message
$logText .= "-------------------- TRUNCATED LOG --------------------\n";
Expand Down
1 change: 1 addition & 0 deletions core/class/note.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function setId($_id) {
}

public function setName($_name) {
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed,$this->name,$_name);
$this->name = $_name;
return $this;
Expand Down
1 change: 1 addition & 0 deletions core/class/plan3d.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ public function setId($_id) {
}

public function setName($_name) {
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed, $this->name, $_name);
$this->name = $_name;
return $this;
Expand Down
1 change: 1 addition & 0 deletions core/class/plan3dHeader.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public function setId($_id) {
}

public function setName($_name) {
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed, $this->name, $_name);
$this->name = $_name;
return $this;
Expand Down
1 change: 1 addition & 0 deletions core/class/planHeader.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public function setId($_id) {
}

public function setName($_name) {
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed, $this->name, $_name);
$this->name = $_name;
return $this;
Expand Down
13 changes: 13 additions & 0 deletions core/class/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class plugin {
private $installation;
private $author;
private $require;
private $requireOsVersion;
private $category;
private $filepath;
private $index;
Expand Down Expand Up @@ -95,6 +96,7 @@ public static function byId($_id) {
$plugin->maxDependancyInstallTime = (isset($data['maxDependancyInstallTime'])) ? $data['maxDependancyInstallTime'] : 30;
$plugin->eventjs = (isset($data['eventjs'])) ? $data['eventjs'] : 0;
$plugin->require = (isset($data['require'])) ? $data['require'] : '';
$plugin->requireOsVersion = (isset($data['requireOsVersion'])) ? $data['requireOsVersion'] : '';
$plugin->category = (isset($data['category'])) ? $data['category'] : '';
$plugin->filepath = $path;
$plugin->index = (isset($data['index'])) ? $data['index'] : $data['id'];
Expand Down Expand Up @@ -931,6 +933,13 @@ public function setIsEnable($_state, $_force = false, $_foreground = false) {
if (version_compare(jeedom::version(), $this->getRequire()) == -1 && $_state == 1) {
throw new Exception(__('Votre version de Jeedom n\'est pas assez récente pour activer ce plugin', __FILE__));
}
$osVersion = $this->getRequireOsVersion();
$distrib = system::getDistrib();
if(isset($osVersion)){
if ($distrib == 'debian' && version_compare(system::getOsVersion(), $osVersion) == -1 && $_state == 1) {
throw new Exception(__('Votre version Debian n\'est pas assez récente pour activer cette version du plugin, '.$osVersion.' minimum demandé', __FILE__));
}
}
$alreadyActive = config::byKey('active', $this->getId(), 0);
if ($_state == 1) {
config::save('active', $_state, $this->getId());
Expand Down Expand Up @@ -1155,6 +1164,10 @@ public function getRequire() {
return $this->require;
}

public function getRequireOsVersion() {
return $this->requireOsVersion;
}

public function getCategory() {
return $this->category;
}
Expand Down
1 change: 1 addition & 0 deletions core/class/scenario.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,7 @@ public function setId($_id) {
*/
public function setName($_name) {
$_name = cleanComponanteName($_name);
$_name = trim($_name);
if ($_name != $this->getName()) {
$this->_changeState = true;
$this->_changed = true;
Expand Down
1 change: 1 addition & 0 deletions core/class/scenarioElement.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ public function getName() {
}

public function setName($_name) {
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed, $this->name, $_name);
$this->name = $_name;
return $this;
Expand Down
1 change: 1 addition & 0 deletions core/class/scenarioSubElement.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function getName() {
}

public function setName($_name) {
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed, $this->name, $_name);
$this->name = $_name;
return $this;
Expand Down
1 change: 1 addition & 0 deletions core/class/timeline.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ public function setId($_id = '') {
}

public function setName($_name) {
$_name = trim($_name);
$this->_changed = utils::attrChanged($this->_changed,$this->name,$_name);
$this->name = $_name;
return $this;
Expand Down
5 changes: 5 additions & 0 deletions core/class/update.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ public function doUpdate() {
$zip = new ZipArchive;
$res = $zip->open($tmp);
if ($res === TRUE) {
if(version_compare(PHP_VERSION, '8.0.0') >= 0){
for($i=0; $i<$zip->numFiles; $i++){
$zip->setMtimeIndex($i, strtotime('now'));
}
}
if (!$zip->extractTo($cibDir . '/')) {
$content = file_get_contents($tmp);
throw new Exception(__("Impossible d'installer le plugin. Les fichiers n'ont pas pu être décompressés", __FILE__) . ' : ' . substr($content, 255));
Expand Down
Loading

0 comments on commit 864afc8

Please sign in to comment.