some bug fixes in wp remote backups;

;
This commit is contained in:
Usman Nasir
2022-07-04 23:09:50 +05:00
parent 8bc41d0d58
commit 1657bbcb10

View File

@@ -989,10 +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 config.timeintervel == function:
if float(al) >= float(Lastrun): #al = float(Currenttime) - float(1800)
#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
@@ -1013,16 +1015,19 @@ Automatic backup failed for %s on %s.
obj.lastrun = time.time() obj.lastrun = time.time()
obj.save() obj.save()
elif config.RemoteBackupConfig.configtype == "S3": elif config.RemoteBackupConfig.configtype == "S3":
IncScheduler.SendToS3Cloud(filename, config.RemoteBackupConfig_id, backupID, config.id) IncScheduler.SendToS3Cloud(filename, config.RemoteBackupConfig_id, backupID,
config.id)
command = f"rm -r {filename}" command = f"rm -r {filename}"
ProcessUtilities.executioner(command) ProcessUtilities.executioner(command)
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 Hour":
al = float(Currenttime) - float(3600) elif config.timeintervel == function:
if float(al) >= float(Lastrun): #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 +1055,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 == "6 Hours":
al = float(Currenttime) - float(21600) elif config.timeintervel == function:
if float(al) >= float(Lastrun): #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