This commit is contained in:
2026-03-09 01:08:02 +01:00
parent 21b119bb93
commit 67552cad0c
2 changed files with 7 additions and 11 deletions

View File

@@ -68,10 +68,8 @@ SH;
$updateCount = null; $updateCount = null;
$updatePreview = ''; $updatePreview = '';
$updateErr = str_contains($updOutStr, '__ERR__NO_APT'); $updateErr = str_contains($updOutStr, '__ERR__NO_APT');
if ($updExit === 0 && !$updateErr) { if (preg_match('/^__COUNT__=(\d+)$/m', $updOutStr, $m)) {
if (preg_match('/^__COUNT__=(\d+)$/m', $updOutStr, $m)) { $updateCount = (int)$m[1];
$updateCount = (int)$m[1];
}
} }
$updatePreview = trim($updOutStr); $updatePreview = trim($updOutStr);
if (strlen($updatePreview) > 1200) { if (strlen($updatePreview) > 1200) {
@@ -92,7 +90,7 @@ SH;
$driver = (string)$pdo->getAttribute(PDO::ATTR_DRIVER_NAME); $driver = (string)$pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
$nowExpr = $driver === 'pgsql' ? 'NOW()' : "DATETIME('now')"; $nowExpr = $driver === 'pgsql' ? 'NOW()' : "DATETIME('now')";
$updCountVal = $updateCount; $updCountVal = $updateCount;
$updErrVal = $updExit === 0 && !$updateErr ? null : trim($updErrStr ?: $updOutStr); $updErrVal = (!$updateErr && $updateCount !== null) ? null : trim($updErrStr ?: $updOutStr);
$upgAvailVal = $upgradeAvailable; $upgAvailVal = $upgradeAvailable;
$upgErrVal = $upgExit === 0 && !$upgradeErr ? null : trim($upgErrStr ?: $upgOutStr); $upgErrVal = $upgExit === 0 && !$upgradeErr ? null : trim($upgErrStr ?: $upgOutStr);
$stmt = $pdo->prepare( $stmt = $pdo->prepare(
@@ -122,7 +120,7 @@ SH;
'count' => $updateCount, 'count' => $updateCount,
'preview' => $updatePreview, 'preview' => $updatePreview,
'raw' => $updatePreview, 'raw' => $updatePreview,
'error' => $updExit === 0 && !$updateErr ? '' : trim($updErrStr ?: $updOutStr), 'error' => (!$updateErr && $updateCount !== null) ? '' : trim($updErrStr ?: $updOutStr),
], ],
'os' => [ 'os' => [
'available' => $upgradeAvailable, 'available' => $upgradeAvailable,

View File

@@ -44,10 +44,8 @@ foreach ($hosts as $host) {
$updateCount = null; $updateCount = null;
$updatePreview = ''; $updatePreview = '';
$updateErr = str_contains($updOutStr, '__ERR__NO_APT'); $updateErr = str_contains($updOutStr, '__ERR__NO_APT');
if ($updExit === 0 && !$updateErr) { if (preg_match('/^__COUNT__=(\d+)$/m', $updOutStr, $m)) {
if (preg_match('/^__COUNT__=(\d+)$/m', $updOutStr, $m)) { $updateCount = (int)$m[1];
$updateCount = (int)$m[1];
}
} }
$updatePreview = trim($updOutStr); $updatePreview = trim($updOutStr);
if (strlen($updatePreview) > 1200) { if (strlen($updatePreview) > 1200) {
@@ -65,7 +63,7 @@ foreach ($hosts as $host) {
} }
} }
$updErrVal = $updExit === 0 && !$updateErr ? null : trim($updErrStr ?: $updOutStr); $updErrVal = (!$updateErr && $updateCount !== null) ? null : trim($updErrStr ?: $updOutStr);
$upgErrVal = $upgExit === 0 && !$upgradeErr ? null : trim($upgErrStr ?: $upgOutStr); $upgErrVal = $upgExit === 0 && !$upgradeErr ? null : trim($upgErrStr ?: $upgOutStr);
$stmt = $pdo->prepare( $stmt = $pdo->prepare(