Skip to content

Commit 2769f21

Browse files
committed
Fixes
* Smoke sensor template fix * Updater check if unpack worked correctly (for market and system update)
1 parent 7821dc3 commit 2769f21

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

modules/market/market.class.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,15 @@ function updateAll($can_be_updated, $frame = 0)
715715

716716

717717
if (IsWindowsOS()) {
718-
//DebMes("Running ".DOC_ROOT.'/gunzip ../'.$file);
719-
exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
720-
//DebMes("Running ".DOC_ROOT.'/tar xvf ../'.str_replace('.tgz', '.tar', $file));
721-
exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
718+
$result = exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
719+
$result = exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
722720
} else {
723-
exec('tar xzvf ../' . $file, $output, $res);
721+
$result = exec('tar xzvf ../' . $file, $output, $res);
722+
}
723+
724+
if (!$result) {
725+
$this->echonow("Unpack failed!", 'red');
726+
return false;
724727
}
725728

726729
$x = 0;
@@ -1045,12 +1048,18 @@ function upload(&$out, $frame = 0)
10451048
}
10461049
if (IsWindowsOS()) {
10471050
// for windows only
1048-
exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
1049-
exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
1051+
$result = exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
1052+
$result = exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
10501053
@unlink('../' . str_replace('.tgz', '.tar', $file));
10511054
} else {
1052-
exec('tar xzvf ../' . $file, $output, $res);
1055+
$result = exec('tar xzvf ../' . $file, $output, $res);
10531056
}
1057+
1058+
if (!$result) {
1059+
$this->echonow("Unpack failed!", 'red');
1060+
return false;
1061+
}
1062+
10541063
if ($frame) {
10551064
$this->echonow(" OK <br/>", 'green');
10561065
}

modules/saverestore/saverestore.class.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,11 +1323,16 @@ function upload(&$out, $iframe = 0)
13231323
echonow('<div><i style="font-size: 7pt;" class="glyphicon glyphicon-usd"></i> '.LANG_UPDATEBACKUP_UNPACKEGE.' '.$file.'</div>');
13241324
}
13251325
if (IsWindowsOS()) {
1326-
exec(DOC_ROOT . DIRECTORY_SEPARATOR . 'gunzip ..' . DIRECTORY_SEPARATOR . $file, $output, $res);
1327-
passthru(DOC_ROOT . DIRECTORY_SEPARATOR . 'tar -xvf ..' . DIRECTORY_SEPARATOR . str_replace('.tgz', '.tar', $file), $res);
1326+
$result = exec(DOC_ROOT . DIRECTORY_SEPARATOR . 'gunzip ..' . DIRECTORY_SEPARATOR . $file, $output, $res);
1327+
$result = exec(DOC_ROOT . DIRECTORY_SEPARATOR . 'tar -xvf ..' . DIRECTORY_SEPARATOR . str_replace('.tgz', '.tar', $file), $output, $res);
13281328
} else {
1329-
exec('tar xzvf ../' . $file, $output, $res);
1329+
$result = exec('tar xzvf ../' . $file, $output, $res);
13301330
}
1331+
if (!$result) {
1332+
echonow("Unpack failed",'red');
1333+
return false;
1334+
}
1335+
13311336

13321337
$UpdatesDir = scandir(DOC_ROOT . DIRECTORY_SEPARATOR . 'cms/saverestore/temp',1);
13331338
$folder = DIRECTORY_SEPARATOR . $UpdatesDir[0];

templates/classes/views/SSmoke.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<div class="device-widget %.alive|"offline;online"%">
2424
<div class="device-icon smoke %.status|"off;on"%"></div>
2525
<div class="device-header">%.object_description%</div>
26-
<<div class="device-details">
26+
<div class="device-details">
2727
<span class="updatedText-JS-%.object_id%" style="font-size: 11px;">...</span>
2828
<span style="display:%.batteryOperated|"none;inline"%;
2929
%.batteryWarning|"0=color:green;1=color:red;2=color:lightsalmon"%;"><i class="glyphicon glyphicon-flash"></i>%.batteryLevel%%</span>

0 commit comments

Comments
 (0)