mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-10-26 07:46:35 +01:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user