redis mh: change php version'
This commit is contained in:
parent
e2a3e81fc6
commit
f6b571b91b
|
|
@ -73,7 +73,7 @@ class PHPManager:
|
|||
upload_max_filesize = ""
|
||||
max_input_time = ""
|
||||
|
||||
command = "sudo cat " + PHPManager.FindPHPFPMPath(phpVersion)
|
||||
command = "cat " + PHPManager.FindPHPFPMPath(phpVersion)
|
||||
|
||||
data = ProcessUtilities.outputExecutioner(command).split('\n')
|
||||
|
||||
|
|
|
|||
|
|
@ -570,34 +570,45 @@ class vhost:
|
|||
return [0, str(msg) + " [IO Error with per host config file [changePHP]"]
|
||||
else:
|
||||
try:
|
||||
data = open(vhFile, "r").readlines()
|
||||
if not os.path.exists(vhost.redisConf):
|
||||
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]"]
|
||||
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'
|
||||
|
||||
for items in data:
|
||||
if items.find("AddHandler application/x-httpd") > -1:
|
||||
writeDataToFile.writelines(finalString)
|
||||
else:
|
||||
writeDataToFile.writelines(items)
|
||||
for items in data:
|
||||
if items.find("AddHandler application/x-httpd") > -1:
|
||||
writeDataToFile.writelines(finalString)
|
||||
else:
|
||||
writeDataToFile.writelines(items)
|
||||
|
||||
writeDataToFile.close()
|
||||
writeDataToFile.close()
|
||||
|
||||
writeToFile = open(phpDetachUpdatePath, 'w')
|
||||
writeToFile.close()
|
||||
writeToFile = open(phpDetachUpdatePath, 'w')
|
||||
writeToFile.close()
|
||||
|
||||
installUtilities.installUtilities.reStartLiteSpeed()
|
||||
try:
|
||||
os.remove(phpDetachUpdatePath)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
command = 'redis-cli get "vhost:%s"' % (vhFile.split('/')[-2])
|
||||
configData = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
import re
|
||||
configData = re.sub(r'"phpVersion": .*,', '"phpVersion": %s,' % (phpVersion.lstrip('PHP ')), configData)
|
||||
|
||||
command = "redis-cli set vhost:%s '%s'" % (vhFile.split('/')[-2], configData)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
installUtilities.installUtilities.reStartLiteSpeed()
|
||||
try:
|
||||
os.remove(phpDetachUpdatePath)
|
||||
except:
|
||||
pass
|
||||
|
||||
print("1,None")
|
||||
return 1, 'None'
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ from plogical.cronUtil import CronUtil
|
|||
from re import match,I,M
|
||||
from plogical import randomPassword
|
||||
from .StagingSetup import StagingSetup
|
||||
from plogical.vhost import vhost
|
||||
|
||||
|
||||
class WebsiteManager:
|
||||
|
|
|
|||
Loading…
Reference in New Issue