Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
* Smoke sensor template fix
* Updater check if unpack worked correctly (for market and system update)
  • Loading branch information
sergejey committed Aug 26, 2022
1 parent 7821dc3 commit 2769f21
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
25 changes: 17 additions & 8 deletions modules/market/market.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,15 @@ function updateAll($can_be_updated, $frame = 0)


if (IsWindowsOS()) {
//DebMes("Running ".DOC_ROOT.'/gunzip ../'.$file);
exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
//DebMes("Running ".DOC_ROOT.'/tar xvf ../'.str_replace('.tgz', '.tar', $file));
exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
$result = exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
$result = exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
} else {
exec('tar xzvf ../' . $file, $output, $res);
$result = exec('tar xzvf ../' . $file, $output, $res);
}

if (!$result) {
$this->echonow("Unpack failed!", 'red');
return false;
}

$x = 0;
Expand Down Expand Up @@ -1045,12 +1048,18 @@ function upload(&$out, $frame = 0)
}
if (IsWindowsOS()) {
// for windows only
exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
$result = exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
$result = exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
@unlink('../' . str_replace('.tgz', '.tar', $file));
} else {
exec('tar xzvf ../' . $file, $output, $res);
$result = exec('tar xzvf ../' . $file, $output, $res);
}

if (!$result) {
$this->echonow("Unpack failed!", 'red');
return false;
}

if ($frame) {
$this->echonow(" OK <br/>", 'green');
}
Expand Down
11 changes: 8 additions & 3 deletions modules/saverestore/saverestore.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1323,11 +1323,16 @@ function upload(&$out, $iframe = 0)
echonow('<div><i style="font-size: 7pt;" class="glyphicon glyphicon-usd"></i> '.LANG_UPDATEBACKUP_UNPACKEGE.' '.$file.'</div>');
}
if (IsWindowsOS()) {
exec(DOC_ROOT . DIRECTORY_SEPARATOR . 'gunzip ..' . DIRECTORY_SEPARATOR . $file, $output, $res);
passthru(DOC_ROOT . DIRECTORY_SEPARATOR . 'tar -xvf ..' . DIRECTORY_SEPARATOR . str_replace('.tgz', '.tar', $file), $res);
$result = exec(DOC_ROOT . DIRECTORY_SEPARATOR . 'gunzip ..' . DIRECTORY_SEPARATOR . $file, $output, $res);
$result = exec(DOC_ROOT . DIRECTORY_SEPARATOR . 'tar -xvf ..' . DIRECTORY_SEPARATOR . str_replace('.tgz', '.tar', $file), $output, $res);
} else {
exec('tar xzvf ../' . $file, $output, $res);
$result = exec('tar xzvf ../' . $file, $output, $res);
}
if (!$result) {
echonow("Unpack failed",'red');
return false;
}


$UpdatesDir = scandir(DOC_ROOT . DIRECTORY_SEPARATOR . 'cms/saverestore/temp',1);
$folder = DIRECTORY_SEPARATOR . $UpdatesDir[0];
Expand Down
2 changes: 1 addition & 1 deletion templates/classes/views/SSmoke.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="device-widget %.alive|"offline;online"%">
<div class="device-icon smoke %.status|"off;on"%"></div>
<div class="device-header">%.object_description%</div>
<<div class="device-details">
<div class="device-details">
<span class="updatedText-JS-%.object_id%" style="font-size: 11px;">...</span>
<span style="display:%.batteryOperated|"none;inline"%;
%.batteryWarning|"0=color:green;1=color:red;2=color:lightsalmon"%;"><i class="glyphicon glyphicon-flash"></i>%.batteryLevel%%</span>
Expand Down

0 comments on commit 2769f21

Please sign in to comment.