From c40c78dcf0cd145800876bf73c25888e774262de Mon Sep 17 00:00:00 2001 From: Babak Alizadeh Date: Thu, 6 Mar 2025 00:50:54 +0000 Subject: [PATCH] update command --- hesabixCore/src/Command/UpdateSoftwareCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hesabixCore/src/Command/UpdateSoftwareCommand.php b/hesabixCore/src/Command/UpdateSoftwareCommand.php index 4de58f4..1ede008 100644 --- a/hesabixCore/src/Command/UpdateSoftwareCommand.php +++ b/hesabixCore/src/Command/UpdateSoftwareCommand.php @@ -291,9 +291,13 @@ class UpdateSoftwareCommand extends Command private function backupDatabase(): string { $backupFile = $this->backupDir . '/db_backup_' . time() . '.sql'; - $dbUrl = $this->params->get('database_url'); - $urlParts = parse_url($dbUrl); + $dbUrl = getenv('DATABASE_URL'); + if (!$dbUrl) { + throw new \RuntimeException('DATABASE_URL environment variable is not set.'); + } + + $urlParts = parse_url($dbUrl); $dbHost = $urlParts['host'] ?? 'localhost'; $dbUser = $urlParts['user'] ?? 'root'; $dbPass = $urlParts['pass'] ?? '';