mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
Improvments to WordPress and Joomla installer!
This commit is contained in:
@@ -14,7 +14,7 @@ import subprocess
|
||||
import shlex
|
||||
import os
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from django.utils.translation import ugettext,ungettext
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
# Create your views here.
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ def getSystemStatus(request):
|
||||
HTTPData = SystemInformation.getSystemInformation()
|
||||
|
||||
try:
|
||||
command = "sudo cat /tmp/lshttpd/tempReport"
|
||||
logging.CyberCPLogFileWriter.writeToFile(shlex.split(command))
|
||||
command = "sudo cat /tmp/lshttpd/.rtreport"
|
||||
data = subprocess.check_output(shlex.split(command)).split("\n")
|
||||
|
||||
httpData = data[3]
|
||||
@@ -91,7 +90,7 @@ def getSystemStatus(request):
|
||||
HTTPData['AvailSSL'] = finalHTTP[14]
|
||||
|
||||
except BaseException,msg:
|
||||
|
||||
#logging.CyberCPLogFileWriter.writeToFile("Failed to read status file, error: " + str(msg))
|
||||
HTTPData['RequestProcessing'] = 0
|
||||
HTTPData['TotalRequests'] = 0
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@ import platform
|
||||
import os
|
||||
import datetime
|
||||
import math
|
||||
import argparse
|
||||
|
||||
class SystemInformation:
|
||||
now = datetime.datetime.now()
|
||||
olsReport = ""
|
||||
|
||||
@staticmethod
|
||||
def cpuLoad():
|
||||
@@ -96,3 +98,23 @@ class SystemInformation:
|
||||
'diskUsage': 0}
|
||||
|
||||
return SystemInfo
|
||||
|
||||
@staticmethod
|
||||
def populateOLSReport():
|
||||
SystemInformation.olsReport = open("/tmp/lshttpd/.rtreport", "r").readlines()
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||
parser.add_argument('function', help='Specific a function to call!')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.function == "populateOLSReport":
|
||||
SystemInformation.populateOLSReport()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -217,10 +217,12 @@ class virtualHostUtilities:
|
||||
extprocessor = "extprocessor "+virtualHostUser+" {\n"
|
||||
type = " type lsapi\n"
|
||||
address = " address UDS://tmp/lshttpd/"+virtualHostUser+".sock\n"
|
||||
maxConns = " maxConns 35\n"
|
||||
maxConns = " maxConns 10\n"
|
||||
env = " env LSAPI_CHILDREN=10\n"
|
||||
initTimeout = " initTimeout 60\n"
|
||||
retryTimeout = " retryTimeout 0\n"
|
||||
persistConn = " persistConn 1\n"
|
||||
persistConnTimeout = " pcKeepAliveTimeout 1\n"
|
||||
respBuffer = " respBuffer 0\n"
|
||||
autoStart = " autoStart 1\n"
|
||||
path = " path /usr/local/lsws/lsphp"+php+"/bin/lsphp\n"
|
||||
@@ -236,9 +238,11 @@ class virtualHostUtilities:
|
||||
confFile.writelines(type)
|
||||
confFile.writelines(address)
|
||||
confFile.writelines(maxConns)
|
||||
confFile.writelines(env)
|
||||
confFile.writelines(initTimeout)
|
||||
confFile.writelines(retryTimeout)
|
||||
confFile.writelines(persistConn)
|
||||
confFile.writelines(persistConnTimeout)
|
||||
confFile.writelines(respBuffer)
|
||||
confFile.writelines(autoStart)
|
||||
confFile.writelines(path)
|
||||
@@ -499,10 +503,12 @@ class virtualHostUtilities:
|
||||
extprocessor = "extprocessor " + virtualHostUser+sockRandomPath + " {\n"
|
||||
type = " type lsapi\n"
|
||||
address = " address UDS://tmp/lshttpd/" + virtualHostUser+sockRandomPath + ".sock\n"
|
||||
maxConns = " maxConns 35\n"
|
||||
maxConns = " maxConns 10\n"
|
||||
env = " env LSAPI_CHILDREN=10\n"
|
||||
initTimeout = " initTimeout 60\n"
|
||||
retryTimeout = " retryTimeout 0\n"
|
||||
persistConn = " persistConn 1\n"
|
||||
persistConnTimeout = " pcKeepAliveTimeout 1\n"
|
||||
respBuffer = " respBuffer 0\n"
|
||||
autoStart = " autoStart 1\n"
|
||||
path = " path /usr/local/lsws/lsphp" + php + "/bin/lsphp\n"
|
||||
@@ -518,9 +524,11 @@ class virtualHostUtilities:
|
||||
confFile.writelines(type)
|
||||
confFile.writelines(address)
|
||||
confFile.writelines(maxConns)
|
||||
confFile.writelines(env)
|
||||
confFile.writelines(initTimeout)
|
||||
confFile.writelines(retryTimeout)
|
||||
confFile.writelines(persistConn)
|
||||
confFile.writelines(persistConnTimeout)
|
||||
confFile.writelines(respBuffer)
|
||||
confFile.writelines(autoStart)
|
||||
confFile.writelines(path)
|
||||
@@ -1283,6 +1291,7 @@ def installWordPress(domainName,finalPath,virtualHostUser,dbName,dbUser,dbPasswo
|
||||
except BaseException, msg:
|
||||
# remove the downloaded files
|
||||
try:
|
||||
|
||||
shutil.rmtree(finalPath)
|
||||
except:
|
||||
logging.CyberCPLogFileWriter.writeToFile("shutil.rmtree(finalPath)")
|
||||
@@ -1305,9 +1314,15 @@ def installJoomla(domainName,finalPath,virtualHostUser,dbName,dbUser,dbPassword,
|
||||
try:
|
||||
FNULL = open(os.devnull, 'w')
|
||||
|
||||
|
||||
|
||||
if not os.path.exists(finalPath):
|
||||
os.makedirs(finalPath)
|
||||
|
||||
## checking for directories/files
|
||||
|
||||
dirFiles = os.listdir(finalPath)
|
||||
|
||||
if len(dirFiles) == 1:
|
||||
if dirFiles[0] == ".well-known":
|
||||
pass
|
||||
|
||||
@@ -1170,7 +1170,6 @@ def installWordpress(request):
|
||||
execPath = execPath + " installWordPress --virtualHostName " + domainName + " --virtualHostUser " + externalApp + " --path " + finalPath + " --dbName " + dbName + " --dbUser " + dbUser + " --dbPassword " + dbPassword
|
||||
|
||||
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
@@ -1178,6 +1177,9 @@ def installWordpress(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
||||
db = Databases.objects.get(dbName=dbName)
|
||||
db.delete()
|
||||
data_ret = {'installStatus': 0, 'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1292,6 +1294,9 @@ def installJoomla(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
mysqlUtilities.deleteDatabase(dbName,dbUser)
|
||||
db = Databases.objects.get(dbName=dbName)
|
||||
db.delete()
|
||||
data_ret = {'installStatus': 0, 'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
Reference in New Issue
Block a user