From 32db00d1ae3943442964439626cbce34e2961315 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 15 Oct 2025 00:56:45 +0500 Subject: [PATCH] Fix backup file moving to handle compressed database backups - Check for .sql.gz files first, then fallback to .sql - Also move .backup.json metadata files alongside compressed backups - Maintains backward compatibility with legacy .sql backups --- plogical/backupUtilities.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 0f65b5d62..0042694ec 100644 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -2457,8 +2457,17 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): ## This login can be further improved later. logging.CyberCPLogFileWriter.writeToFile('Failed to create database backup for %s. This could be false positive, moving on.' % (dbName)) - command = f'mv /home/cyberpanel/{dbName}.sql {CPHomeStorage}/{dbName}.sql' - ProcessUtilities.executioner(command) + # Move database backup (check for both .sql.gz and .sql) + if os.path.exists(f'/home/cyberpanel/{dbName}.sql.gz'): + command = f'mv /home/cyberpanel/{dbName}.sql.gz {CPHomeStorage}/{dbName}.sql.gz' + ProcessUtilities.executioner(command) + # Also move metadata file if it exists + if os.path.exists(f'/home/cyberpanel/{dbName}.backup.json'): + command = f'mv /home/cyberpanel/{dbName}.backup.json {CPHomeStorage}/{dbName}.backup.json' + ProcessUtilities.executioner(command) + elif os.path.exists(f'/home/cyberpanel/{dbName}.sql'): + command = f'mv /home/cyberpanel/{dbName}.sql {CPHomeStorage}/{dbName}.sql' + ProcessUtilities.executioner(command) ##