Fix virtio iso, libreelec and openelec download progress display

This commit is contained in:
Eric Schultz
2017-07-22 11:59:57 -05:00
parent 3c7e1f0a43
commit a29c8dcce1
4 changed files with 23 additions and 23 deletions

View File

@@ -507,7 +507,7 @@ switch ($action) {
if (!file_exists($strLogFile)) {
if (!pgrep($strDownloadPgrep)) {
if (!pgrep($strDownloadPgrep, false)) {
// Status = done
$arrResponse['status'] = 'Done';
@@ -523,7 +523,7 @@ switch ($action) {
} else {
if (pgrep($strDownloadPgrep)) {
if (pgrep($strDownloadPgrep, false)) {
// Get Download percent completed
$intSize = filesize($strTargetFile);
@@ -534,7 +534,7 @@ switch ($action) {
$arrResponse['status'] = 'Downloading ... ' . $strPercent . '%';
} elseif (pgrep($strVerifyPgrep)) {
} elseif (pgrep($strVerifyPgrep, false)) {
// Status = running md5 check
$arrResponse['status'] = 'Verifying ... ';
@@ -560,7 +560,7 @@ switch ($action) {
// Status = running md5 check
$arrResponse['status'] = 'Downloading ... 100%';
if (!pgrep($strInstallScriptPgrep) && !$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep, false) && !$boolCheckOnly) {
// Run all commands
file_put_contents($strInstallScript, $strAllCmd);
@@ -575,7 +575,7 @@ switch ($action) {
} elseif (!$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep)) {
if (!pgrep($strInstallScriptPgrep, false)) {
// Run all commands
file_put_contents($strInstallScript, $strAllCmd);
@@ -588,7 +588,7 @@ switch ($action) {
}
$arrResponse['pid'] = pgrep($strInstallScriptPgrep);
$arrResponse['pid'] = pgrep($strInstallScriptPgrep, false);
}
break;
@@ -609,7 +609,7 @@ switch ($action) {
$arrResponse = ['error' => 'ISO storage path doesn\'t exist'];
} else {
$strInstallScriptPgrep = '-f "VirtIOWin_' . $strKeyName . '_install.sh"';
$pid = pgrep($strInstallScriptPgrep);
$pid = pgrep($strInstallScriptPgrep, false);
if (!$pid) {
$arrResponse = ['error' => 'Not running'];
} else {

View File

@@ -149,7 +149,7 @@
$arrResponse['localfolder'] = dirname($strExtractedFile);
} else {
if (pgrep($strExtractPgrep)) {
if (pgrep($strExtractPgrep, false)) {
// Status = running extract
$arrResponse['status'] = 'Extracting ... ';
@@ -164,7 +164,7 @@
} elseif (file_exists($strTempFile)) {
if (pgrep($strDownloadPgrep)) {
if (pgrep($strDownloadPgrep, false)) {
// Get Download percent completed
$intSize = filesize($strTempFile);
@@ -175,7 +175,7 @@
$arrResponse['status'] = 'Downloading ... ' . $strPercent . '%';
} elseif (pgrep($strVerifyPgrep)) {
} elseif (pgrep($strVerifyPgrep, false)) {
// Status = running md5 check
$arrResponse['status'] = 'Verifying ... ';
@@ -185,7 +185,7 @@
// Status = running extract
$arrResponse['status'] = 'Extracting ... ';
if (!pgrep($strExtractPgrep)) {
if (!pgrep($strExtractPgrep, false)) {
// Examine md5 status
$strMD5StatusContents = file_get_contents($strMD5StatusFile);
@@ -203,7 +203,7 @@
// Status = running md5 check
$arrResponse['status'] = 'Downloading ... 100%';
if (!pgrep($strInstallScriptPgrep) && !$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep, false) && !$boolCheckOnly) {
// Run all commands
file_put_contents($strInstallScript, $strAllCmd);
@@ -216,7 +216,7 @@
} elseif (!$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep)) {
if (!pgrep($strInstallScriptPgrep, false)) {
// Run all commands
file_put_contents($strInstallScript, $strAllCmd);
@@ -229,7 +229,7 @@
}
$arrResponse['pid'] = pgrep($strInstallScriptPgrep);
$arrResponse['pid'] = pgrep($strInstallScriptPgrep, false);
}

View File

@@ -149,7 +149,7 @@
$arrResponse['localfolder'] = dirname($strExtractedFile);
} else {
if (pgrep($strExtractPgrep)) {
if (pgrep($strExtractPgrep, false)) {
// Status = running extract
$arrResponse['status'] = 'Extracting ... ';
@@ -164,7 +164,7 @@
} elseif (file_exists($strTempFile)) {
if (pgrep($strDownloadPgrep)) {
if (pgrep($strDownloadPgrep, false)) {
// Get Download percent completed
$intSize = filesize($strTempFile);
@@ -175,7 +175,7 @@
$arrResponse['status'] = 'Downloading ... ' . $strPercent . '%';
} elseif (pgrep($strVerifyPgrep)) {
} elseif (pgrep($strVerifyPgrep, false)) {
// Status = running md5 check
$arrResponse['status'] = 'Verifying ... ';
@@ -185,7 +185,7 @@
// Status = running extract
$arrResponse['status'] = 'Extracting ... ';
if (!pgrep($strExtractPgrep)) {
if (!pgrep($strExtractPgrep, false)) {
// Examine md5 status
$strMD5StatusContents = file_get_contents($strMD5StatusFile);
@@ -203,7 +203,7 @@
// Status = running md5 check
$arrResponse['status'] = 'Downloading ... 100%';
if (!pgrep($strInstallScriptPgrep) && !$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep, false) && !$boolCheckOnly) {
// Run all commands
file_put_contents($strInstallScript, $strAllCmd);
@@ -216,7 +216,7 @@
} elseif (!$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep)) {
if (!pgrep($strInstallScriptPgrep, false)) {
// Run all commands
file_put_contents($strInstallScript, $strAllCmd);
@@ -229,7 +229,7 @@
}
$arrResponse['pid'] = pgrep($strInstallScriptPgrep);
$arrResponse['pid'] = pgrep($strInstallScriptPgrep, false);
}

View File

@@ -170,8 +170,8 @@ function read_parity_log($epoch,$busy=false) {
function urlencode_path($path) {
return str_replace("%2F", "/", urlencode($path));
}
function pgrep($process_name) {
$pid = exec("pgrep ".escapeshellarg($process_name), $output, $retval);
function pgrep($process_name,$escape_arg=true) {
$pid = exec("pgrep ".($escape_arg?escapeshellarg($process_name):$process_name), $output, $retval);
return $retval == 0 ? $pid : false;
}
function input_secure_users($sec) {