restart detached php asap

This commit is contained in:
Usman Nasir
2020-02-19 14:36:21 +05:00
parent abff77faa3
commit 89ec69ec68
2 changed files with 16 additions and 7 deletions

View File

@@ -151,7 +151,7 @@ class PHPManager:
allow_url_include = "allow_url_include = Off" allow_url_include = "allow_url_include = Off"
path = PHPManager.FindPHPFPMPath(phpVersion) path = PHPManager.FindPHPFPMPath(phpVersion)
command = "sudo cat " + path command = "cat " + path
data = ProcessUtilities.outputExecutioner(command).splitlines() data = ProcessUtilities.outputExecutioner(command).splitlines()
tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999)) tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999))
@@ -187,7 +187,7 @@ class PHPManager:
writeToFile.close() writeToFile.close()
command = "sudo mv %s %s" % (tempStatusPath, path) command = "mv %s %s" % (tempStatusPath, path)
ProcessUtilities.executioner(command) ProcessUtilities.executioner(command)
php = PHPManager.getPHPString(phpVersion) php = PHPManager.getPHPString(phpVersion)
@@ -204,7 +204,7 @@ class PHPManager:
@staticmethod @staticmethod
def fetchPHPSettingsAdvance(phpVersion): def fetchPHPSettingsAdvance(phpVersion):
command = "sudo cat " + PHPManager.FindPHPFPMPath(phpVersion) command = "cat " + PHPManager.FindPHPFPMPath(phpVersion)
data = ProcessUtilities.outputExecutioner(command) data = ProcessUtilities.outputExecutioner(command)
final_dic = {'fetchStatus': 1, final_dic = {'fetchStatus': 1,
'configData': data, 'configData': data,
@@ -227,7 +227,7 @@ class PHPManager:
writeToFile.write(configData) writeToFile.write(configData)
writeToFile.close() writeToFile.close()
command = "sudo mv %s %s" % (tempStatusPath, path) command = "mv %s %s" % (tempStatusPath, path)
ProcessUtilities.executioner(command) ProcessUtilities.executioner(command)
php = PHPManager.getPHPString(phpVersion) php = PHPManager.getPHPString(phpVersion)

View File

@@ -99,6 +99,9 @@ class phpUtilities:
@staticmethod @staticmethod
def savePHPConfigBasic(phpVers,allow_url_fopen,display_errors,file_uploads,allow_url_include,memory_limit,max_execution_time,upload_max_filesize,max_input_time,post_max_size): def savePHPConfigBasic(phpVers,allow_url_fopen,display_errors,file_uploads,allow_url_include,memory_limit,max_execution_time,upload_max_filesize,max_input_time,post_max_size):
try: try:
serverLevelPHPRestart = '/usr/local/lsws/admin/tmp/.lsphp_restart.txt'
command = 'touch %s' % (serverLevelPHPRestart)
ProcessUtilities.executioner(command)
if ProcessUtilities.decideDistro() == ProcessUtilities.centos: if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini" path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
@@ -156,13 +159,19 @@ class phpUtilities:
@staticmethod @staticmethod
def savePHPConfigAdvance(phpVers,tempPath): def savePHPConfigAdvance(phpVers,tempPath):
try: try:
serverLevelPHPRestart = '/usr/local/lsws/admin/tmp/.lsphp_restart.txt'
command = 'touch %s' % (serverLevelPHPRestart)
ProcessUtilities.executioner(command)
phpINI = open(phpVers, 'w') phpINI = open(phpVers, 'w')
phpINI.write(open(tempPath, "r").read()) phpINI.write(open(tempPath, "r").read())
phpINI.close() phpINI.close()
installUtilities.installUtilities.reStartLiteSpeed()
if os.path.exists(tempPath): if os.path.exists(serverLevelPHPRestart):
os.remove(tempPath) os.remove(serverLevelPHPRestart)
installUtilities.installUtilities.reStartLiteSpeed()
print("1,None") print("1,None")
except BaseException as msg: except BaseException as msg: