mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-14 17:26:17 +01:00
added check for not-available php versions
This commit is contained in:
@@ -110,15 +110,15 @@ DATABASES = {
|
|||||||
'ENGINE': 'django.db.backends.mysql',
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
'NAME': 'cyberpanel',
|
'NAME': 'cyberpanel',
|
||||||
'USER': 'cyberpanel',
|
'USER': 'cyberpanel',
|
||||||
'PASSWORD': 'a9AwLb7zY7ZwCd',
|
'PASSWORD': 'Bz9gF7Hr7X4RtD',
|
||||||
'HOST': '127.0.0.1',
|
'HOST': '127.0.0.1',
|
||||||
'PORT':''
|
'PORT':'3307'
|
||||||
},
|
},
|
||||||
'rootdb': {
|
'rootdb': {
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
'NAME': 'mysql',
|
'NAME': 'mysql',
|
||||||
'USER': 'root',
|
'USER': 'root',
|
||||||
'PASSWORD': '3bL8X7wGo0kT3b',
|
'PASSWORD': 'sXm5VlRaAsXkDd',
|
||||||
'HOST': 'localhost',
|
'HOST': 'localhost',
|
||||||
'PORT': '',
|
'PORT': '',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ def preDockerRun(function):
|
|||||||
return render(request, 'dockerManager/install.html', {'status':admin.type, 'conErr':0})
|
return render(request, 'dockerManager/install.html', {'status':admin.type, 'conErr':0})
|
||||||
|
|
||||||
# Check if docker is running and we are able to connect
|
# Check if docker is running and we are able to connect
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = docker.from_env()
|
client = docker.from_env()
|
||||||
client.ping()
|
client.ping()
|
||||||
|
|||||||
@@ -686,6 +686,10 @@ class vhost:
|
|||||||
|
|
||||||
php = PHPManager.getPHPString(phpVersion)
|
php = PHPManager.getPHPString(phpVersion)
|
||||||
|
|
||||||
|
if not os.path.exists("/usr/local/lsws/lsphp" + str(php) + "/bin/lsphp"):
|
||||||
|
print 0, 'This PHP version is not available on your CyberPanel.'
|
||||||
|
return [0, "[This PHP version is not available on your CyberPanel. [changePHP]"]
|
||||||
|
|
||||||
writeDataToFile = open(vhFile, "w")
|
writeDataToFile = open(vhFile, "w")
|
||||||
|
|
||||||
path = " path /usr/local/lsws/lsphp" + str(php) + "/bin/lsphp\n"
|
path = " path /usr/local/lsws/lsphp" + str(php) + "/bin/lsphp\n"
|
||||||
@@ -704,15 +708,19 @@ class vhost:
|
|||||||
return 1,'None'
|
return 1,'None'
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
str(msg) + " [IO Error with per host config file [changePHP]]")
|
str(msg) + " [IO Error with per host config file [changePHP]")
|
||||||
print 0,str(msg)
|
print 0,str(msg)
|
||||||
return [0, str(msg) + " [IO Error with per host config file [changePHP]]"]
|
return [0, str(msg) + " [IO Error with per host config file [changePHP]"]
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
data = open(vhFile, "r").readlines()
|
data = open(vhFile, "r").readlines()
|
||||||
|
|
||||||
php = PHPManager.getPHPString(phpVersion)
|
php = PHPManager.getPHPString(phpVersion)
|
||||||
|
|
||||||
|
if not os.path.exists("/usr/local/lsws/lsphp" + str(php) + "/bin/lsphp"):
|
||||||
|
print 0, 'This PHP version is not available on your CyberPanel.'
|
||||||
|
return [0, "[This PHP version is not available on your CyberPanel. [changePHP]"]
|
||||||
|
|
||||||
writeDataToFile = open(vhFile, "w")
|
writeDataToFile = open(vhFile, "w")
|
||||||
|
|
||||||
finalString = ' AddHandler application/x-httpd-php' + str(php) + ' .php\n'
|
finalString = ' AddHandler application/x-httpd-php' + str(php) + ' .php\n'
|
||||||
|
|||||||
@@ -394,6 +394,7 @@ app.controller('servicesManager', function ($scope, $http) {
|
|||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
console.log(response.data)
|
||||||
|
|
||||||
if (response.data.status.litespeed) {
|
if (response.data.status.litespeed) {
|
||||||
$scope.olsStatus = "Running";
|
$scope.olsStatus = "Running";
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import time
|
|||||||
import serverStatusUtil
|
import serverStatusUtil
|
||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
from plogical.httpProc import httpProc
|
from plogical.httpProc import httpProc
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
def serverStatusHome(request):
|
def serverStatusHome(request):
|
||||||
@@ -26,8 +28,8 @@ def serverStatusHome(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
def litespeedStatus(request):
|
|
||||||
|
|
||||||
|
def litespeedStatus(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -60,8 +62,9 @@ def litespeedStatus(request):
|
|||||||
|
|
||||||
except subprocess.CalledProcessError, msg:
|
except subprocess.CalledProcessError, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||||
return render(request,"serverStatus/litespeedStatus.html",{"processList":processList,"liteSpeedVersionStatus":"For some reaons not able to load version details, see CyberCP main log file.", 'OLS': OLS})
|
return render(request, "serverStatus/litespeedStatus.html", {"processList": processList,
|
||||||
|
"liteSpeedVersionStatus": "For some reaons not able to load version details, see CyberCP main log file.",
|
||||||
|
'OLS': OLS})
|
||||||
|
|
||||||
if (processList != 0):
|
if (processList != 0):
|
||||||
dataForHtml = {"processList": processList, "lsversion": lsversion, "modules": modules,
|
dataForHtml = {"processList": processList, "lsversion": lsversion, "modules": modules,
|
||||||
@@ -76,6 +79,7 @@ def litespeedStatus(request):
|
|||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def stopOrRestartLitespeed(request):
|
def stopOrRestartLitespeed(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -109,8 +113,8 @@ def stopOrRestartLitespeed(request):
|
|||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[stopOrRestartLitespeed]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[stopOrRestartLitespeed]")
|
||||||
return HttpResponse("Not Logged in as admin")
|
return HttpResponse("Not Logged in as admin")
|
||||||
|
|
||||||
def cyberCPMainLogFile(request):
|
|
||||||
|
|
||||||
|
def cyberCPMainLogFile(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
|
|
||||||
@@ -121,13 +125,13 @@ def cyberCPMainLogFile(request):
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
|
||||||
return render(request, 'serverStatus/cybercpmainlogfile.html')
|
return render(request, 'serverStatus/cybercpmainlogfile.html')
|
||||||
|
|
||||||
except KeyError, msg:
|
except KeyError, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[cyberCPMainLogFile]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[cyberCPMainLogFile]")
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def getFurtherDataFromLogFile(request):
|
def getFurtherDataFromLogFile(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -145,10 +149,12 @@ def getFurtherDataFromLogFile(request):
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
except KeyError, msg:
|
except KeyError, msg:
|
||||||
status = {"logstatus":0,"error":"Could not fetch data from log file, please see CyberCP main log file through command line."}
|
status = {"logstatus": 0,
|
||||||
|
"error": "Could not fetch data from log file, please see CyberCP main log file through command line."}
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[getFurtherDataFromLogFile]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[getFurtherDataFromLogFile]")
|
||||||
return HttpResponse("Not Logged in as admin")
|
return HttpResponse("Not Logged in as admin")
|
||||||
|
|
||||||
|
|
||||||
def services(request):
|
def services(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -175,6 +181,7 @@ def services(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def servicesStatus(request):
|
def servicesStatus(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -263,6 +270,7 @@ def servicesStatus(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def servicesAction(request):
|
def servicesAction(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -324,6 +332,7 @@ def servicesAction(request):
|
|||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
def switchTOLSWS(request):
|
def switchTOLSWS(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -352,6 +361,7 @@ def switchTOLSWS(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def switchTOLSWSStatus(request):
|
def switchTOLSWSStatus(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -376,6 +386,7 @@ def switchTOLSWSStatus(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def licenseStatus(request):
|
def licenseStatus(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -391,7 +402,6 @@ def licenseStatus(request):
|
|||||||
command = 'sudo cat /usr/local/lsws/conf/serial.no'
|
command = 'sudo cat /usr/local/lsws/conf/serial.no'
|
||||||
serial = subprocess.check_output(shlex.split(command))
|
serial = subprocess.check_output(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
command = 'sudo /usr/local/lsws/bin/lshttpd -V'
|
command = 'sudo /usr/local/lsws/bin/lshttpd -V'
|
||||||
expiration = subprocess.check_output(shlex.split(command))
|
expiration = subprocess.check_output(shlex.split(command))
|
||||||
|
|
||||||
@@ -408,6 +418,7 @@ def licenseStatus(request):
|
|||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
def changeLicense(request):
|
def changeLicense(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -434,14 +445,12 @@ def changeLicense(request):
|
|||||||
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
command = 'sudo /usr/local/lsws/bin/lshttpd -r'
|
command = 'sudo /usr/local/lsws/bin/lshttpd -r'
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo /usr/local/lsws/bin/lswsctrl restart'
|
command = 'sudo /usr/local/lsws/bin/lswsctrl restart'
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
final_dic = {'status': 1, "erroMessage": 'None'}
|
final_dic = {'status': 1, "erroMessage": 'None'}
|
||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
@@ -455,6 +464,7 @@ def changeLicense(request):
|
|||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
def topProcesses(request):
|
def topProcesses(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -473,6 +483,7 @@ def topProcesses(request):
|
|||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def topProcessesStatus(request):
|
def topProcessesStatus(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -491,7 +502,6 @@ def topProcessesStatus(request):
|
|||||||
loadNow = data[2].split(' ')
|
loadNow = data[2].split(' ')
|
||||||
loadNow = filter(lambda a: a != '', loadNow)
|
loadNow = filter(lambda a: a != '', loadNow)
|
||||||
|
|
||||||
|
|
||||||
memory = data[3].split(' ')
|
memory = data[3].split(' ')
|
||||||
memory = filter(lambda a: a != '', memory)
|
memory = filter(lambda a: a != '', memory)
|
||||||
|
|
||||||
@@ -589,6 +599,7 @@ def topProcessesStatus(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def killProcess(request):
|
def killProcess(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
|
|||||||
Reference in New Issue
Block a user