more safe-guards

Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
Andy Miller
2025-11-14 16:30:50 +00:00
parent bbed7e5478
commit 7d7d30e4a7

View File

@@ -179,6 +179,14 @@ class SafeUpgradeManager
*/ */
public function restoreSnapshot(string $snapshotId): array public function restoreSnapshot(string $snapshotId): array
{ {
if (!$this->isSafeUpgradeEnabled()) {
return [
'status' => 'error',
'message' => 'Safe upgrade is disabled in configuration.',
'manifest' => null,
];
}
try { try {
$safeUpgrade = $this->getSafeUpgradeService(); $safeUpgrade = $this->getSafeUpgradeService();
$manifest = $safeUpgrade->rollback($snapshotId); $manifest = $safeUpgrade->rollback($snapshotId);
@@ -935,6 +943,12 @@ class SafeUpgradeManager
public function runSnapshot(array $options): array public function runSnapshot(array $options): array
{ {
if (!$this->isSafeUpgradeEnabled()) {
return $this->errorResult('Safe upgrade is disabled in configuration.', [
'operation' => 'snapshot'
]);
}
$label = isset($options['label']) ? (string)$options['label'] : null; $label = isset($options['label']) ? (string)$options['label'] : null;
if ($label !== null) { if ($label !== null) {
$label = trim($label); $label = trim($label);