mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-06-20 21:50:21 +02:00
p3
This commit is contained in:
@@ -23,7 +23,7 @@ class HandleRequest(multi.Thread):
|
||||
def __del__(self):
|
||||
try:
|
||||
self.connection.close()
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [HandleRequest.__del__]')
|
||||
|
||||
def run(self):
|
||||
@@ -62,7 +62,7 @@ class HandleRequest(multi.Thread):
|
||||
self.connection.close()
|
||||
break
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile( str(msg) + ' [HandleRequest.run]')
|
||||
finally:
|
||||
limitThreads.release()
|
||||
@@ -136,6 +136,6 @@ class HandleRequest(multi.Thread):
|
||||
self.connection.sendall('action=dunno\n\n')
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + " [HandleRequest.manageRequest]")
|
||||
self.connection.sendall('action=defer_if_permit Service temporarily unavailable\n\n')
|
||||
|
||||
@@ -15,14 +15,14 @@ class cacheManager:
|
||||
def flushCache():
|
||||
try:
|
||||
|
||||
for domain, domainOBJ in cacheManager.domains.iteritems():
|
||||
for domain, domainOBJ in cacheManager.domains.items():
|
||||
domaindb = Domains.objects.get(domain=domain)
|
||||
dbDomain = DomainLimits.objects.get(domain=domaindb)
|
||||
|
||||
dbDomain.monthlyUsed = domainOBJ.monthlyUsed
|
||||
dbDomain.save()
|
||||
|
||||
for email, emailOBJ in domainOBJ.emails.iteritems():
|
||||
for email, emailOBJ in domainOBJ.emails.items():
|
||||
emailID = EUsers.objects.get(email=email)
|
||||
dbEmail = EmailLimits.objects.get(email=emailID)
|
||||
|
||||
@@ -30,7 +30,7 @@ class cacheManager:
|
||||
dbEmail.hourlyUsed = emailOBJ.hourlyUsed
|
||||
dbEmail.save()
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.flushCache]')
|
||||
|
||||
@staticmethod
|
||||
@@ -44,7 +44,7 @@ class cacheManager:
|
||||
emailOBJ = domainOBJ.emails[emailAddress]
|
||||
emailOBJ.logStatus = operationValue
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.disableEnableLogs]')
|
||||
|
||||
@staticmethod
|
||||
@@ -59,7 +59,7 @@ class cacheManager:
|
||||
emailOBJ = domainOBJ.emails[email]
|
||||
emailOBJ.logStatus = operationVal
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.purgeLog]')
|
||||
|
||||
@staticmethod
|
||||
@@ -74,7 +74,7 @@ class cacheManager:
|
||||
emailOBJ = domainOBJ.emails[email]
|
||||
emailOBJ.limitStatus = operationVal
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.purgeLimit]')
|
||||
|
||||
@staticmethod
|
||||
@@ -87,7 +87,7 @@ class cacheManager:
|
||||
domainOBJ = cacheManager.domains[domain]
|
||||
domainOBJ.limitStatus = operationVal
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.purgeLimitDomain]')
|
||||
|
||||
@staticmethod
|
||||
@@ -100,7 +100,7 @@ class cacheManager:
|
||||
domainOBJ = cacheManager.domains[domain]
|
||||
domainOBJ.monthlyLimits = newLimit
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.updateDomainLimit]')
|
||||
|
||||
@staticmethod
|
||||
@@ -117,14 +117,14 @@ class cacheManager:
|
||||
emailOBJ.monthlyLimits = monthlyLimit
|
||||
emailOBJ.hourlyLimits = hourlyLimit
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.purgeLimitEmail]')
|
||||
|
||||
@staticmethod
|
||||
def hourlyCleanUP():
|
||||
try:
|
||||
for domain, domainOBJ in cacheManager.domains.iteritems():
|
||||
for email, emailOBJ in domainOBJ.emails.iteritems():
|
||||
for domain, domainOBJ in cacheManager.domains.items():
|
||||
for email, emailOBJ in domainOBJ.emails.items():
|
||||
|
||||
emailID = EUsers.objects.get(email=email)
|
||||
dbEmail = EmailLimits.objects.get(email=emailID)
|
||||
@@ -135,19 +135,19 @@ class cacheManager:
|
||||
dbEmail.hourlyUsed = 0
|
||||
emailOBJ.hourlyUsed = 0
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.hourlyCleanUP]')
|
||||
|
||||
@staticmethod
|
||||
def monthlyCleanUP():
|
||||
try:
|
||||
|
||||
for domain, domainOBJ in cacheManager.domains.iteritems():
|
||||
for domain, domainOBJ in cacheManager.domains.items():
|
||||
domaindb = Domains.objects.get(domain=domain)
|
||||
dbDomain = DomainLimits.objects.get(domain=domaindb)
|
||||
|
||||
|
||||
for email, emailOBJ in domainOBJ.emails.iteritems():
|
||||
for email, emailOBJ in domainOBJ.emails.items():
|
||||
emailID = EUsers.objects.get(email=email)
|
||||
dbEmail = EmailLimits.objects.get(email=emailID)
|
||||
|
||||
@@ -160,7 +160,7 @@ class cacheManager:
|
||||
dbDomain.monthlyUsed = 0
|
||||
dbDomain.save()
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.monthlyCleanUP]')
|
||||
|
||||
|
||||
@@ -191,6 +191,6 @@ class cacheManager:
|
||||
cacheManager.monthlyCleanUP()
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheManager.handlePurgeRequest]')
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class cacheClient:
|
||||
writeToFile.write(command)
|
||||
writeToFile.close()
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [cacheClient.handleCachePurgeRequest]')
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class policyCTRL:
|
||||
pid = open(path, "r").readlines()[0]
|
||||
try:
|
||||
os.kill(int(pid), signal.SIGTERM)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ class SetupConn:
|
||||
uid = pwd.getpwnam("postfix").pw_uid
|
||||
gid = grp.getgrnam("postfix").gr_gid
|
||||
os.chown(self.server_addr, uid, gid)
|
||||
os.chmod(self.server_addr, 0755)
|
||||
os.chmod(self.server_addr, 0o755)
|
||||
|
||||
logging.writeToFile('CyberPanel Email Policy Server Successfully started!')
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [SetupConn.setup_conn]')
|
||||
|
||||
def start_listening(self):
|
||||
@@ -63,7 +63,7 @@ class SetupConn:
|
||||
connection, client_address = self.sock.accept()
|
||||
background = handle.HandleRequest(connection)
|
||||
background.start()
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [SetupConn.start_listening]')
|
||||
|
||||
def __del__(self):
|
||||
|
||||
Reference in New Issue
Block a user