mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
some bug fixes in wp remote backups;
;
This commit is contained in:
@@ -989,40 +989,12 @@ Automatic backup failed for %s on %s.
|
|||||||
|
|
||||||
Lastrun = config.lastrun
|
Lastrun = config.lastrun
|
||||||
Currenttime = float(time.time())
|
Currenttime = float(time.time())
|
||||||
if config.timeintervel == "30 Minutes":
|
|
||||||
al = float(Currenttime) - float(1800)
|
|
||||||
if float(al) >= float(Lastrun):
|
|
||||||
#if 1 == 1:
|
|
||||||
extraArgs = {}
|
|
||||||
extraArgs['adminID'] = Admin.pk
|
|
||||||
extraArgs['WPid'] = wpsite.pk
|
|
||||||
extraArgs['Backuptype'] = Backuptype
|
|
||||||
extraArgs['BackupDestination'] = config.RemoteBackupConfig.configtype
|
|
||||||
extraArgs['SFTPID'] = config.RemoteBackupConfig_id
|
|
||||||
|
|
||||||
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
if config.timeintervel == function:
|
||||||
background = ApplicationInstaller('WPCreateBackup', extraArgs)
|
#al = float(Currenttime) - float(1800)
|
||||||
status, msg, backupID = background.WPCreateBackup()
|
#if float(al) >= float(Lastrun):
|
||||||
if status == 1:
|
|
||||||
filename = msg
|
|
||||||
if config.RemoteBackupConfig.configtype == "SFTP":
|
|
||||||
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
|
||||||
command = f"rm -r {filename}"
|
|
||||||
ProcessUtilities.executioner(command)
|
|
||||||
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
|
||||||
obj.lastrun = time.time()
|
|
||||||
obj.save()
|
|
||||||
elif config.RemoteBackupConfig.configtype == "S3":
|
|
||||||
IncScheduler.SendToS3Cloud(filename, config.RemoteBackupConfig_id, backupID, config.id)
|
|
||||||
command = f"rm -r {filename}"
|
|
||||||
ProcessUtilities.executioner(command)
|
|
||||||
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
|
||||||
obj.lastrun = time.time()
|
|
||||||
obj.save()
|
|
||||||
elif config.timeintervel == "1 Hour":
|
|
||||||
al = float(Currenttime) - float(3600)
|
|
||||||
if float(al) >= float(Lastrun):
|
|
||||||
#if 1 == 1:
|
#if 1 == 1:
|
||||||
|
|
||||||
extraArgs = {}
|
extraArgs = {}
|
||||||
extraArgs['adminID'] = Admin.pk
|
extraArgs['adminID'] = Admin.pk
|
||||||
extraArgs['WPid'] = wpsite.pk
|
extraArgs['WPid'] = wpsite.pk
|
||||||
@@ -1050,9 +1022,44 @@ Automatic backup failed for %s on %s.
|
|||||||
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
obj.lastrun = time.time()
|
obj.lastrun = time.time()
|
||||||
obj.save()
|
obj.save()
|
||||||
elif config.timeintervel == "6 Hours":
|
|
||||||
al = float(Currenttime) - float(21600)
|
elif config.timeintervel == function:
|
||||||
if float(al) >= float(Lastrun):
|
#al = float(Currenttime) - float(3600)
|
||||||
|
#if float(al) >= float(Lastrun):
|
||||||
|
# if 1 == 1:
|
||||||
|
|
||||||
|
extraArgs = {}
|
||||||
|
extraArgs['adminID'] = Admin.pk
|
||||||
|
extraArgs['WPid'] = wpsite.pk
|
||||||
|
extraArgs['Backuptype'] = Backuptype
|
||||||
|
extraArgs['BackupDestination'] = config.RemoteBackupConfig.configtype
|
||||||
|
extraArgs['SFTPID'] = config.RemoteBackupConfig_id
|
||||||
|
|
||||||
|
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||||
|
background = ApplicationInstaller('WPCreateBackup', extraArgs)
|
||||||
|
status, msg, backupID = background.WPCreateBackup()
|
||||||
|
if status == 1:
|
||||||
|
filename = msg
|
||||||
|
if config.RemoteBackupConfig.configtype == "SFTP":
|
||||||
|
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
|
elif config.RemoteBackupConfig.configtype == "S3":
|
||||||
|
IncScheduler.SendToS3Cloud(filename, config.RemoteBackupConfig_id, backupID,
|
||||||
|
config.id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
|
|
||||||
|
elif config.timeintervel == function:
|
||||||
|
#al = float(Currenttime) - float(21600)
|
||||||
|
#if float(al) >= float(Lastrun):
|
||||||
|
|
||||||
extraArgs = {}
|
extraArgs = {}
|
||||||
extraArgs['adminID'] = Admin.pk
|
extraArgs['adminID'] = Admin.pk
|
||||||
extraArgs['WPid'] = wpsite.pk
|
extraArgs['WPid'] = wpsite.pk
|
||||||
@@ -1080,9 +1087,10 @@ Automatic backup failed for %s on %s.
|
|||||||
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
obj.lastrun = time.time()
|
obj.lastrun = time.time()
|
||||||
obj.save()
|
obj.save()
|
||||||
elif config.timeintervel == "12 Hours":
|
|
||||||
al = float(Currenttime) - float(43200)
|
elif config.timeintervel == function:
|
||||||
if float(al) >= float(Lastrun):
|
#al = float(Currenttime) - float(43200)
|
||||||
|
#if float(al) >= float(Lastrun):
|
||||||
extraArgs = {}
|
extraArgs = {}
|
||||||
extraArgs['adminID'] = Admin.pk
|
extraArgs['adminID'] = Admin.pk
|
||||||
extraArgs['WPid'] = wpsite.pk
|
extraArgs['WPid'] = wpsite.pk
|
||||||
@@ -1110,9 +1118,11 @@ Automatic backup failed for %s on %s.
|
|||||||
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
obj.lastrun = time.time()
|
obj.lastrun = time.time()
|
||||||
obj.save()
|
obj.save()
|
||||||
elif config.timeintervel == "1 Day":
|
|
||||||
al = float(Currenttime) - float(86400)
|
elif config.timeintervel == function:
|
||||||
if float(al) >= float(Lastrun):
|
#al = float(Currenttime) - float(86400)
|
||||||
|
#if float(al) >= float(Lastrun):
|
||||||
|
|
||||||
extraArgs = {}
|
extraArgs = {}
|
||||||
extraArgs['adminID'] = Admin.pk
|
extraArgs['adminID'] = Admin.pk
|
||||||
extraArgs['WPid'] = wpsite.pk
|
extraArgs['WPid'] = wpsite.pk
|
||||||
@@ -1140,9 +1150,11 @@ Automatic backup failed for %s on %s.
|
|||||||
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
obj.lastrun = time.time()
|
obj.lastrun = time.time()
|
||||||
obj.save()
|
obj.save()
|
||||||
elif config.timeintervel == "3 Days":
|
|
||||||
al = float(Currenttime) - float(259200)
|
elif config.timeintervel == function:
|
||||||
if float(al) >= float(Lastrun):
|
#al = float(Currenttime) - float(259200)
|
||||||
|
#if float(al) >= float(Lastrun):
|
||||||
|
|
||||||
extraArgs = {}
|
extraArgs = {}
|
||||||
extraArgs['adminID'] = Admin.pk
|
extraArgs['adminID'] = Admin.pk
|
||||||
extraArgs['WPid'] = wpsite.pk
|
extraArgs['WPid'] = wpsite.pk
|
||||||
@@ -1170,9 +1182,11 @@ Automatic backup failed for %s on %s.
|
|||||||
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
obj.lastrun = time.time()
|
obj.lastrun = time.time()
|
||||||
obj.save()
|
obj.save()
|
||||||
elif config.timeintervel == "1 Week":
|
|
||||||
al = float(Currenttime) - float(604800)
|
elif config.timeintervel == function:
|
||||||
if float(al) >= float(Lastrun):
|
#al = float(Currenttime) - float(604800)
|
||||||
|
#if float(al) >= float(Lastrun):
|
||||||
|
|
||||||
extraArgs = {}
|
extraArgs = {}
|
||||||
extraArgs['adminID'] = Admin.pk
|
extraArgs['adminID'] = Admin.pk
|
||||||
extraArgs['WPid'] = wpsite.pk
|
extraArgs['WPid'] = wpsite.pk
|
||||||
@@ -1200,6 +1214,7 @@ Automatic backup failed for %s on %s.
|
|||||||
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
obj.lastrun = time.time()
|
obj.lastrun = time.time()
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
print("Error in Sites:%s" % str(msg))
|
print("Error in Sites:%s" % str(msg))
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user