increase backup file holder name size

This commit is contained in:
Usman Nasir
2020-04-28 17:51:31 +05:00
parent 98272a85ec
commit 6a9c774fcb
3 changed files with 16 additions and 11 deletions

View File

@@ -480,25 +480,25 @@ class backupUtilities:
rmtree(tempStoragePath) rmtree(tempStoragePath)
### ###
backupFileNamePath = os.path.join(backupPath, "backupFileName")
fileName = open(backupFileNamePath, 'r').read()
backupObs = Backups.objects.filter(fileName=fileName) backupObs = Backups.objects.filter(fileName=backupName)
## adding backup data to database. ## adding backup data to database.
filePath = '%s/%s.tar.gz' % (backupPath, backupName)
totalSize = '%sMB' % (str(int(os.path.getsize(filePath) / 1048576)))
try: try:
for items in backupObs: for items in backupObs:
items.status = 1 items.status = 1
items.size = str(int(float( items.size = totalSize
os.path.getsize(os.path.join(backupPath, backupName + ".tar.gz"))) / (
1024.0 * 1024.0))) + "MB"
items.save() items.save()
except: logging.CyberCPLogFileWriter.writeToFile(' again size: %s' % (totalSize))
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile('%s. [backupRoot:499]' % str(msg))
for items in backupObs: for items in backupObs:
items.status = 1 items.status = 1
items.size = str(int(float( items.size = totalSize
os.path.getsize(os.path.join(backupPath, backupName + ".tar.gz"))) / (
1024.0 * 1024.0))) + "MB"
items.save() items.save()
command = 'chmod 600 %s' % (os.path.join(backupPath, backupName + ".tar.gz")) command = 'chmod 600 %s' % (os.path.join(backupPath, backupName + ".tar.gz"))

View File

@@ -579,6 +579,11 @@ class Upgrade:
except: except:
pass pass
try:
cursor.execute("ALTER TABLE websiteFunctions_backups MODIFY fileName varchar(200)")
except:
pass
try: try:
cursor.execute("ALTER TABLE loginSystem_acl ADD COLUMN listUsers INT DEFAULT 0;") cursor.execute("ALTER TABLE loginSystem_acl ADD COLUMN listUsers INT DEFAULT 0;")

View File

@@ -29,7 +29,7 @@ class ChildDomains(models.Model):
class Backups(models.Model): class Backups(models.Model):
website = models.ForeignKey(Websites,on_delete=models.CASCADE) website = models.ForeignKey(Websites,on_delete=models.CASCADE)
fileName = models.CharField(max_length=50) fileName = models.CharField(max_length=200)
date = models.CharField(max_length=50) date = models.CharField(max_length=50)
size = models.CharField(max_length=50) size = models.CharField(max_length=50)
status = models.IntegerField(default=0) status = models.IntegerField(default=0)