refactor: streamline key installation feedback

- Simplified success messages in both PHP class and shell script after key installation.
- Removed unnecessary conditional checks for array state, providing a more straightforward success response.

This change aims to enhance clarity in user feedback during key installation. No further changes are pending for this task.
This commit is contained in:
Zack Spear
2025-07-10 09:58:42 -07:00
parent 2350d8ec08
commit 67bbd68664
2 changed files with 7 additions and 16 deletions

View File

@@ -60,16 +60,11 @@ class KeyInstaller
exec("/usr/bin/wget -q -O " . escapeshellarg("/boot/config/$keyFile") . " " . escapeshellarg($url), $output, $returnVar);
if ($returnVar === 0) {
exec("emcmd \"checkRegistration=Apply\"");
$var = (array)@parse_ini_file('/var/local/emhttp/var.ini');
if (_var($var, 'mdState') == "STARTED") {
return $this->responseComplete(200, [
'status' => 'success',
'message' => _('Please Stop array to complete key installation'),
]);
} else {
return $this->responseComplete(200, ['status' => 'success']);
}
exec('emcmd '.escapeshellarg('checkRegistration=Apply'));
return $this->responseComplete(200, [
'status' => 'success',
'message' => _('Key installed'),
]);
} else {
@unlink(escapeshellarg("/boot/config/$keyFile"));
return $this->responseComplete(406, ['error' => _('download error') . " $returnVar"]);

View File

@@ -34,12 +34,8 @@ if (in_array($host,['keys.lime-technology.com','lime-technology.com'])) {
write("Downloading $keyfile ...\n");
exec("/usr/bin/wget -q -O ".escapeshellarg("/boot/config/$key_file")." ".escapeshellarg($url), $output, $return_var);
if ($return_var === 0) {
exec("emcmd \"checkRegistration=Apply\"");
if (parse_ini_file('/var/local/emhttp/var.ini')['mdState'] == 'STARTED') {
write("Installing ... Please Stop array to complete key installation.\n");
} else {
write("Installed ...\n");
}
exec('emcmd '.escapeshellarg('checkRegistration=Apply'));
write("Key installed ...\n");
} else {
write("ERROR: $return_var\n");
switch($return_var) {