From 3a01ab79227b781885663ae2d749b0d0b874d46b Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Wed, 17 May 2023 20:02:35 +0500 Subject: [PATCH] bug fix: php manager --- ApachController/ApacheController.py | 35 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/ApachController/ApacheController.py b/ApachController/ApacheController.py index 8499e9da4..cca886dc4 100755 --- a/ApachController/ApacheController.py +++ b/ApachController/ApacheController.py @@ -130,32 +130,31 @@ LoadModule mpm_event_module modules/mod_mpm_event.so CurrentConf = open(confPath, 'r').read() - data = open(confPath, 'r').readlines() - writeToFile = open(confPath, 'w') + if CurrentConf.find('Listen 8083') == -1: - for items in data: - if items.find("Listen") > -1 and items.find("80") > -1 and items.find('#') == -1: - if CurrentConf.find('Listen 8083') ==-1: + data = open(confPath, 'r').readlines() + writeToFile = open(confPath, 'w') + + for items in data: + if items.find("Listen") > -1 and items.find("80") > -1 and items.find('#') == -1: writeToFile.writelines("Listen 8083\nListen 8082\n") - elif items.find("User") > -1 and items.find('#') == -1: - if CurrentConf.find('User nobody') == -1: + elif items.find("User") > -1 and items.find('#') == -1: writeToFile.writelines("User nobody\n") - elif items.find("Group") > -1 and items.find('#') == -1: - if CurrentConf.find('Group nobody') == -1: + elif items.find("Group") > -1 and items.find('#') == -1: writeToFile.writelines("Group nobody\n") writeToFile.writelines('SetEnv LSWS_EDITION Openlitespeed\nSetEnv X-LSCACHE on\n') - elif items[0] == "#": - continue - else: - writeToFile.writelines(items) + elif items[0] == "#": + continue + else: + writeToFile.writelines(items) - writeToFile.close() + writeToFile.close() - # MPM Module Configurations + # MPM Module Configurations - writeToFile = open(ApacheController.mpmConfigsPath, 'w') - writeToFile.write(ApacheController.mpmConfigs) - writeToFile.close() + writeToFile = open(ApacheController.mpmConfigsPath, 'w') + writeToFile.write(ApacheController.mpmConfigs) + writeToFile.close() else: