mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-03-01 09:50:44 +01:00
p3
This commit is contained in:
@@ -155,7 +155,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
metaFileXML.append(dnsRecordsXML)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [158:prepMeta]' % (str(msg)), 1)
|
||||
|
||||
## Email accounts XML
|
||||
@@ -176,7 +176,7 @@ class IncJobs(multi.Thread):
|
||||
emailRecordsXML.append(emailRecordXML)
|
||||
|
||||
metaFileXML.append(emailRecordsXML)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(self.statusPath, '%s. [warning:179:prepMeta]' % (str(msg)), 1)
|
||||
|
||||
## Email meta generated!
|
||||
@@ -196,7 +196,7 @@ class IncJobs(multi.Thread):
|
||||
metaFile = open(metaPath, 'w')
|
||||
metaFile.write(xmlpretty)
|
||||
metaFile.close()
|
||||
os.chmod(metaPath, 0640)
|
||||
os.chmod(metaPath, 0o640)
|
||||
|
||||
## meta generated
|
||||
|
||||
@@ -211,7 +211,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
return 1
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [207][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -239,7 +239,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
logging.statusWriter(self.statusPath, 'Data for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupData.223][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -271,7 +271,7 @@ class IncJobs(multi.Thread):
|
||||
destination=self.backupDestinations)
|
||||
newSnapshot.save()
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -304,7 +304,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
logging.statusWriter(self.statusPath, 'Emails for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -323,7 +323,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
logging.statusWriter(self.statusPath, 'Repo %s initiated for %s.' % (self.backupDestinations, self.website.domain), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,'%s. [IncJobs.initiateRepo.47][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ class IncJobs(multi.Thread):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
####
|
||||
@@ -163,7 +163,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath, result, 1)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [88][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -240,7 +240,7 @@ class IncJobs(multi.Thread):
|
||||
else:
|
||||
self.awsFunction('restore', '', self.jobid.snapshotid)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [138][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -274,10 +274,10 @@ class IncJobs(multi.Thread):
|
||||
os.remove('/home/cyberpanel/%s' % (self.path.split('/')[-1]))
|
||||
else:
|
||||
os.remove('/home/cyberpanel/%s.sql' % (self.jobid.type.split(':')[1]))
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [160][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -297,7 +297,7 @@ class IncJobs(multi.Thread):
|
||||
else:
|
||||
self.awsFunction('restore', '', self.jobid.snapshotid)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [46][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -328,7 +328,7 @@ class IncJobs(multi.Thread):
|
||||
except:
|
||||
pass
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [46][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -400,7 +400,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath, message, 1)
|
||||
|
||||
logging.statusWriter(self.statusPath, 'Completed', 1)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.extraArgs['tempPath'], str(msg), 1)
|
||||
|
||||
### Backup functions
|
||||
@@ -520,7 +520,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
metaFileXML.append(dnsRecordsXML)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [158:prepMeta]' % (str(msg)), 1)
|
||||
|
||||
## Email accounts XML
|
||||
@@ -541,7 +541,7 @@ class IncJobs(multi.Thread):
|
||||
emailRecordsXML.append(emailRecordXML)
|
||||
|
||||
metaFileXML.append(emailRecordsXML)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [warning:179:prepMeta]' % (str(msg)), 1)
|
||||
|
||||
## Email meta generated!
|
||||
@@ -561,7 +561,7 @@ class IncJobs(multi.Thread):
|
||||
metaFile = open(metaPath, 'w')
|
||||
metaFile.write(xmlpretty)
|
||||
metaFile.close()
|
||||
os.chmod(metaPath, 0640)
|
||||
os.chmod(metaPath, 0o640)
|
||||
|
||||
## meta generated
|
||||
|
||||
@@ -573,7 +573,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
return 1
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [207][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -592,7 +592,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Data for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.backupData.223][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -617,11 +617,11 @@ class IncJobs(multi.Thread):
|
||||
|
||||
try:
|
||||
os.remove('/home/cyberpanel/%s.sql' % (items.dbName))
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Failed to delete database: %s. [IncJobs.backupDatabases.456]' % str(msg), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -641,7 +641,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Emails for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.emailBackup.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -661,7 +661,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Meta for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.metaBackup.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -691,7 +691,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Repo %s initiated for %s.' % (self.backupDestinations, self.website.domain), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.initiateRepo.47][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -763,7 +763,7 @@ Subject: %s
|
||||
try:
|
||||
command = 'rm -f %s' % (metaPathNew)
|
||||
ProcessUtilities.executioner(command)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Failed to delete meta file: %s. [IncJobs.createBackup.591]' % str(msg), 1)
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class IncScheduler():
|
||||
|
||||
logging.statusWriter(IncScheduler.logPath, 'Failed backup for %s, error: %s.' % (web.website, result), 1)
|
||||
break
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
from websiteFunctions.models import Websites
|
||||
|
||||
@@ -49,7 +49,7 @@ class restoreMeta():
|
||||
|
||||
virtualHostUtilities.createDomain(masterDomain, domain, phpSelection, path, 0, 0, 0,
|
||||
'admin', 0)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + " [startRestore]")
|
||||
return 0
|
||||
|
||||
@@ -92,7 +92,7 @@ class restoreMeta():
|
||||
'Email created: %s' % (
|
||||
email))
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + " [startRestore]")
|
||||
return 0
|
||||
|
||||
@@ -148,7 +148,7 @@ class restoreMeta():
|
||||
except:
|
||||
pass
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + " [startRestore]")
|
||||
|
||||
def main():
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.shortcuts import render
|
||||
from plogical.acl import ACLManager
|
||||
@@ -48,7 +48,7 @@ def createBackup(request):
|
||||
destinations.append('s3:s3.amazonaws.com/%s' % (items))
|
||||
|
||||
return defRenderer(request, 'IncBackups/createBackup.html', {'websiteList': websitesName, 'destinations': destinations})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -61,7 +61,7 @@ def backupDestinations(request):
|
||||
return ACLManager.loadError()
|
||||
|
||||
return defRenderer(request, 'IncBackups/incrementalDestinations.html', {})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -168,7 +168,7 @@ def addDestination(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -235,7 +235,7 @@ def populateCurrentRecords(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -264,7 +264,7 @@ def removeDestination(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'destStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -337,7 +337,7 @@ def fetchCurrentBackups(request):
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -398,7 +398,7 @@ def submitBackupCreation(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", 'tempPath': tempPath})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -456,7 +456,7 @@ def getBackupStatus(request):
|
||||
final_json = json.dumps({'backupStatus': 1, 'error_message': "None", "status": 1, "abort": 0})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'backupStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
logging.writeToFile(str(msg) + " [backupStatus]")
|
||||
@@ -483,7 +483,7 @@ def deleteBackup(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'destStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -528,7 +528,7 @@ def fetchRestorePoints(request):
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -576,7 +576,7 @@ def restorePoint(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", 'tempPath': tempPath})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -607,7 +607,7 @@ def scheduleBackups(request):
|
||||
destinations.append('s3:s3.amazonaws.com/%s' % (items))
|
||||
|
||||
return defRenderer(request, 'IncBackups/backupSchedule.html', {'websiteList': websitesName, 'destinations': destinations})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -657,7 +657,7 @@ def submitBackupSchedule(request):
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -690,7 +690,7 @@ def getCurrentBackupSchedules(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -713,7 +713,7 @@ def scheduleDelete(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -741,6 +741,6 @@ def restoreRemoteBackups(request):
|
||||
destinations.append('s3:s3.amazonaws.com/%s' % (items))
|
||||
|
||||
return defRenderer(request, 'IncBackups/restoreRemoteBackups.html', {'websiteList': websitesName, 'destinations': destinations})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
Reference in New Issue
Block a user