fix: file creation user

This commit is contained in:
Usman Nasir
2022-02-11 19:36:14 +05:00
parent af483406c5
commit 8c2b019d03
2 changed files with 10 additions and 3 deletions

View File

@@ -100,6 +100,8 @@ class phpUtilities:
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:
serverLevelPHPRestart = '/usr/local/lsws/admin/tmp/.lsphp_restart.txt'
command = 'touch %s' % (serverLevelPHPRestart)
ProcessUtilities.executioner(command)

View File

@@ -612,6 +612,10 @@ class vhost:
@staticmethod
def changePHP(vhFile, phpVersion):
from pathlib import Path
HomePath = Path("/home/%s" % (vhFile.split('/')[-2]))
virtualHostUser = HomePath.owner()
phpDetachUpdatePath = '/home/%s/.lsphp_restart.txt' % (vhFile.split('/')[-2])
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
try:
@@ -636,12 +640,13 @@ class vhost:
writeDataToFile.close()
writeToFile = open(phpDetachUpdatePath, 'w')
writeToFile.close()
command = 'sudo -u %s touch %s' % (virtualHostUser, phpDetachUpdatePath)
ProcessUtilities.normalExecutioner(command)
installUtilities.installUtilities.reStartLiteSpeed()
try:
os.remove(phpDetachUpdatePath)
command = 'sudo -u %s rm -f %s' % (virtualHostUser, phpDetachUpdatePath)
ProcessUtilities.normalExecutioner(command)
except:
pass
else: