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:
parent
7864ef63c1
commit
32db00d1ae
|
|
@ -2457,8 +2457,17 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
|
||||||
## This login can be further improved later.
|
## 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))
|
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'
|
# Move database backup (check for both .sql.gz and .sql)
|
||||||
ProcessUtilities.executioner(command)
|
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)
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue