Skip to content

Commit 32db00d

Browse files
committed
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
1 parent 7864ef6 commit 32db00d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plogical/backupUtilities.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,8 +2457,17 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
24572457
## This login can be further improved later.
24582458
logging.CyberCPLogFileWriter.writeToFile('Failed to create database backup for %s. This could be false positive, moving on.' % (dbName))
24592459

2460-
command = f'mv /home/cyberpanel/{dbName}.sql {CPHomeStorage}/{dbName}.sql'
2461-
ProcessUtilities.executioner(command)
2460+
# Move database backup (check for both .sql.gz and .sql)
2461+
if os.path.exists(f'/home/cyberpanel/{dbName}.sql.gz'):
2462+
command = f'mv /home/cyberpanel/{dbName}.sql.gz {CPHomeStorage}/{dbName}.sql.gz'
2463+
ProcessUtilities.executioner(command)
2464+
# Also move metadata file if it exists
2465+
if os.path.exists(f'/home/cyberpanel/{dbName}.backup.json'):
2466+
command = f'mv /home/cyberpanel/{dbName}.backup.json {CPHomeStorage}/{dbName}.backup.json'
2467+
ProcessUtilities.executioner(command)
2468+
elif os.path.exists(f'/home/cyberpanel/{dbName}.sql'):
2469+
command = f'mv /home/cyberpanel/{dbName}.sql {CPHomeStorage}/{dbName}.sql'
2470+
ProcessUtilities.executioner(command)
24622471

24632472

24642473
##

0 commit comments

Comments
 (0)