backupsRetention = $this->getBackupsRetention(); if (!isset($this->backupsRetention[$backupId])) { return false; } $currentBackup = $this->backupsRetention[$backupId]; $storageToRemoveKey = array_search($storageToRemove, $currentBackup['storages'], true); if ($storageToRemoveKey === false) { return false; } unset($currentBackup['storages'][$storageToRemoveKey]); $this->backupsRetention[$backupId] = $currentBackup; // Don't hold backup without storage. if (empty($currentBackup['storages'])) { unset($this->backupsRetention[$backupId]); } // Don't hold backup with only localStorage. if (count($currentBackup['storages']) === 1 && reset($currentBackup['storages']) === 'localStorage') { unset($this->backupsRetention[$backupId]); } $this->updateBackupsRetentionOptions($this->backupsRetention); return true; } }