diff --git a/src/Appwrite/Platform/Tasks/Backup.php b/src/Appwrite/Platform/Tasks/Backup.php index 4e1746bcf5..1ace0e9657 100644 --- a/src/Appwrite/Platform/Tasks/Backup.php +++ b/src/Appwrite/Platform/Tasks/Backup.php @@ -88,12 +88,13 @@ class Backup extends Action } } while ($attempts < $max); - $this->xtrabackupContainerId = shell_exec('docker ps -aqf "name=xtrabackup"'); - $this->xtrabackupContainerId = str_replace(PHP_EOL, '', $this->xtrabackupContainerId); - if (empty($this->xtrabackupContainerId)) { + $containerId = shell_exec('docker ps -aqf "name=xtrabackup"'); + $containerId = str_replace(PHP_EOL, '', $containerId); + if (empty($containerId)) { Console::error('Xtrabackup Container ID not found'); Console::exit(); } + $this->xtrabackupContainerId = $containerId; Console::loop(function () { $this->start(); diff --git a/src/Appwrite/Platform/Tasks/Restore.php b/src/Appwrite/Platform/Tasks/Restore.php index 52e348e3a9..5f0737c30d 100644 --- a/src/Appwrite/Platform/Tasks/Restore.php +++ b/src/Appwrite/Platform/Tasks/Restore.php @@ -21,19 +21,21 @@ class Restore extends Action protected ?DSN $dsn = null; protected string $database; protected ?DOSpaces $s3 = null; - protected string|null $xtrabackupContainerId = null; + protected string $xtrabackupContainerId; public function __construct() { $this->checkEnvVariables(); - $this->xtrabackupContainerId = shell_exec('docker ps -aqf "name=xtrabackup"'); - $this->xtrabackupContainerId = str_replace(PHP_EOL, '', $this->xtrabackupContainerId); - if (empty($this->xtrabackupContainerId)) { + $containerId = shell_exec('docker ps -aqf "name=xtrabackup"'); + $containerId = str_replace(PHP_EOL, '', $containerId); + if (empty($containerId)) { Console::error('Xtrabackup Container ID not found'); Console::exit(); } + $this->xtrabackupContainerId = $containerId; + $this ->desc('Restore a DB') ->param('id', '', new Text(20), 'The backup identification')