mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 05:15:49 +01:00
simplify getPHPString() & update php version for mail domain
This commit is contained in:
@@ -7,6 +7,7 @@ from .models import *
|
|||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
|
|
||||||
|
|
||||||
class PHPManager:
|
class PHPManager:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -23,27 +24,9 @@ class PHPManager:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getPHPString(phpVersion):
|
def getPHPString(phpVersion):
|
||||||
|
# Ex: "PHP 5.3" type string, return Ex: "53" type string
|
||||||
if phpVersion == "PHP 5.3":
|
phpVersion = phpVersion.split()
|
||||||
php = "53"
|
php = phpVersion[1].replace(".", "")
|
||||||
elif phpVersion == "PHP 5.4":
|
|
||||||
php = "54"
|
|
||||||
elif phpVersion == "PHP 5.5":
|
|
||||||
php = "55"
|
|
||||||
elif phpVersion == "PHP 5.6":
|
|
||||||
php = "56"
|
|
||||||
elif phpVersion == "PHP 7.0":
|
|
||||||
php = "70"
|
|
||||||
elif phpVersion == "PHP 7.1":
|
|
||||||
php = "71"
|
|
||||||
elif phpVersion == "PHP 7.2":
|
|
||||||
php = "72"
|
|
||||||
elif phpVersion == "PHP 7.3":
|
|
||||||
php = "73"
|
|
||||||
elif phpVersion == "PHP 7.4":
|
|
||||||
php = "74"
|
|
||||||
elif phpVersion == "PHP 8.0":
|
|
||||||
php = "80"
|
|
||||||
|
|
||||||
return php
|
return php
|
||||||
|
|
||||||
@@ -134,22 +117,22 @@ class PHPManager:
|
|||||||
max_input_time = data['max_input_time']
|
max_input_time = data['max_input_time']
|
||||||
post_max_size = data['post_max_size']
|
post_max_size = data['post_max_size']
|
||||||
|
|
||||||
if allow_url_fopen == True:
|
if allow_url_fopen:
|
||||||
allow_url_fopen = "allow_url_fopen = On"
|
allow_url_fopen = "allow_url_fopen = On"
|
||||||
else:
|
else:
|
||||||
allow_url_fopen = "allow_url_fopen = Off"
|
allow_url_fopen = "allow_url_fopen = Off"
|
||||||
|
|
||||||
if display_errors == True:
|
if display_errors:
|
||||||
display_errors = "display_errors = On"
|
display_errors = "display_errors = On"
|
||||||
else:
|
else:
|
||||||
display_errors = "display_errors = Off"
|
display_errors = "display_errors = Off"
|
||||||
|
|
||||||
if file_uploads == True:
|
if file_uploads:
|
||||||
file_uploads = "file_uploads = On"
|
file_uploads = "file_uploads = On"
|
||||||
else:
|
else:
|
||||||
file_uploads = "file_uploads = Off"
|
file_uploads = "file_uploads = Off"
|
||||||
|
|
||||||
if allow_url_include == True:
|
if allow_url_include:
|
||||||
allow_url_include = "allow_url_include = On"
|
allow_url_include = "allow_url_include = On"
|
||||||
else:
|
else:
|
||||||
allow_url_include = "allow_url_include = Off"
|
allow_url_include = "allow_url_include = Off"
|
||||||
@@ -303,7 +286,3 @@ class PHPManager:
|
|||||||
json_data = json_data + ']'
|
json_data = json_data + ']'
|
||||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class virtualHostUtilities:
|
|||||||
childDomain = 'mail.%s' % (virtualHostName)
|
childDomain = 'mail.%s' % (virtualHostName)
|
||||||
childPath = '/home/%s/%s' % (virtualHostName, childDomain)
|
childPath = '/home/%s/%s' % (virtualHostName, childDomain)
|
||||||
|
|
||||||
result = virtualHostUtilities.createDomain(virtualHostName, childDomain, 'PHP 7.2', childPath, 1, 0, 0,
|
result = virtualHostUtilities.createDomain(virtualHostName, childDomain, 'PHP 7.3', childPath, 1, 0, 0,
|
||||||
admin.userName, 0, "/home/cyberpanel/" + str(randint(1000, 9999)))
|
admin.userName, 0, "/home/cyberpanel/" + str(randint(1000, 9999)))
|
||||||
|
|
||||||
if result[0] == 0:
|
if result[0] == 0:
|
||||||
@@ -120,7 +120,7 @@ class virtualHostUtilities:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def createVirtualHost(virtualHostName, administratorEmail, phpVersion, virtualHostUser, ssl,
|
def createVirtualHost(virtualHostName, administratorEmail, phpVersion, virtualHostUser, ssl,
|
||||||
dkimCheck, openBasedir, websiteOwner, packageName, apache,
|
dkimCheck, openBasedir, websiteOwner, packageName, apache,
|
||||||
tempStatusPath='/home/cyberpanel/fakePath', mailDomain = None, LimitsCheck = 1):
|
tempStatusPath='/home/cyberpanel/fakePath', mailDomain=None, LimitsCheck=1):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Running some checks..,0')
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Running some checks..,0')
|
||||||
@@ -505,7 +505,6 @@ class virtualHostUtilities:
|
|||||||
print("1,None")
|
print("1,None")
|
||||||
return 1, 'None'
|
return 1, 'None'
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [issueSSLForHostName]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [issueSSLForHostName]")
|
||||||
print("0," + str(msg))
|
print("0," + str(msg))
|
||||||
@@ -929,7 +928,7 @@ class virtualHostUtilities:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def createDomain(masterDomain, virtualHostName, phpVersion, path, ssl, dkimCheck, openBasedir, owner, apache,
|
def createDomain(masterDomain, virtualHostName, phpVersion, path, ssl, dkimCheck, openBasedir, owner, apache,
|
||||||
tempStatusPath='/home/cyberpanel/fakePath', LimitsCheck = 1):
|
tempStatusPath='/home/cyberpanel/fakePath', LimitsCheck=1):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Running some checks..,0')
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Running some checks..,0')
|
||||||
@@ -957,7 +956,6 @@ class virtualHostUtilities:
|
|||||||
'This domain already exists as child domain. [404]')
|
'This domain already exists as child domain. [404]')
|
||||||
return 0, "This domain already exists as child domain."
|
return 0, "This domain already exists as child domain."
|
||||||
|
|
||||||
|
|
||||||
if ChildDomains.objects.filter(domain=virtualHostName.lstrip('www.')).count() > 0:
|
if ChildDomains.objects.filter(domain=virtualHostName.lstrip('www.')).count() > 0:
|
||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath,
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath,
|
||||||
'This domain already exists as child domain. [404]')
|
'This domain already exists as child domain. [404]')
|
||||||
|
|||||||
Reference in New Issue
Block a user