Skip to content

Commit 6a9c774

Browse files
committed
increase backup file holder name size
1 parent 98272a8 commit 6a9c774

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

plogical/backupUtilities.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -480,25 +480,25 @@ def BackupRoot(tempStoragePath, backupName, backupPath, metaPath=None):
480480
rmtree(tempStoragePath)
481481

482482
###
483-
backupFileNamePath = os.path.join(backupPath, "backupFileName")
484-
fileName = open(backupFileNamePath, 'r').read()
485483

486-
backupObs = Backups.objects.filter(fileName=fileName)
484+
backupObs = Backups.objects.filter(fileName=backupName)
487485

488486
## adding backup data to database.
487+
488+
filePath = '%s/%s.tar.gz' % (backupPath, backupName)
489+
totalSize = '%sMB' % (str(int(os.path.getsize(filePath) / 1048576)))
490+
489491
try:
490492
for items in backupObs:
491493
items.status = 1
492-
items.size = str(int(float(
493-
os.path.getsize(os.path.join(backupPath, backupName + ".tar.gz"))) / (
494-
1024.0 * 1024.0))) + "MB"
494+
items.size = totalSize
495495
items.save()
496-
except:
496+
logging.CyberCPLogFileWriter.writeToFile(' again size: %s' % (totalSize))
497+
except BaseException as msg:
498+
logging.CyberCPLogFileWriter.writeToFile('%s. [backupRoot:499]' % str(msg))
497499
for items in backupObs:
498500
items.status = 1
499-
items.size = str(int(float(
500-
os.path.getsize(os.path.join(backupPath, backupName + ".tar.gz"))) / (
501-
1024.0 * 1024.0))) + "MB"
501+
items.size = totalSize
502502
items.save()
503503

504504
command = 'chmod 600 %s' % (os.path.join(backupPath, backupName + ".tar.gz"))

plogical/upgrade.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,11 @@ def applyLoginSystemMigrations():
579579
except:
580580
pass
581581

582+
try:
583+
cursor.execute("ALTER TABLE websiteFunctions_backups MODIFY fileName varchar(200)")
584+
except:
585+
pass
586+
582587

583588
try:
584589
cursor.execute("ALTER TABLE loginSystem_acl ADD COLUMN listUsers INT DEFAULT 0;")

websiteFunctions/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ChildDomains(models.Model):
2929

3030
class Backups(models.Model):
3131
website = models.ForeignKey(Websites,on_delete=models.CASCADE)
32-
fileName = models.CharField(max_length=50)
32+
fileName = models.CharField(max_length=200)
3333
date = models.CharField(max_length=50)
3434
size = models.CharField(max_length=50)
3535
status = models.IntegerField(default=0)

0 commit comments

Comments
 (0)