added check for not-available php versions

This commit is contained in:
usmannasir
2019-01-09 00:07:36 +05:00
parent f17f17e130
commit cd8f12e912
5 changed files with 61 additions and 40 deletions

View File

@@ -686,6 +686,10 @@ class vhost:
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")
path = " path /usr/local/lsws/lsphp" + str(php) + "/bin/lsphp\n"
@@ -704,15 +708,19 @@ class vhost:
return 1,'None'
except BaseException, msg:
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)
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:
try:
data = open(vhFile, "r").readlines()
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")
finalString = ' AddHandler application/x-httpd-php' + str(php) + ' .php\n'