From 44f7c7e8e820d4c53e9586e5b1dfd1cce42a14d0 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 27 Sep 2024 12:53:43 +0500 Subject: [PATCH] feature: support upto php 8.4 on apache manager --- ApachController/ApacheVhosts.py | 41 +++++++++++++++++++++++++++++++++ plogical/vhost.py | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ApachController/ApacheVhosts.py b/ApachController/ApacheVhosts.py index 80f3e4d0f..271f0f52a 100755 --- a/ApachController/ApacheVhosts.py +++ b/ApachController/ApacheVhosts.py @@ -99,6 +99,11 @@ def DecidePHPPath(php, virtualHostName): finalConfPath = ApacheVhost.php83Path + virtualHostName elif php == '84': finalConfPath = ApacheVhost.php84Path + virtualHostName + elif php == '85': + finalConfPath = ApacheVhost.php85Path + virtualHostName + + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f'Decided path in DecidePHPPath {finalConfPath}.conf') return finalConfPath + '.conf' @@ -535,6 +540,39 @@ def deletePHPPath(virtualHostName): command = f"systemctl restart {phpService}" ProcessUtilities.normalExecutioner(command) + phpPath = ApacheVhost.DecidePHPPath('83', virtualHostName) + if os.path.exists(phpPath): + os.remove(phpPath) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php83-php-fpm' + else: + phpService = f"php8.3-fpm" + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + phpPath = ApacheVhost.DecidePHPPath('84', virtualHostName) + if os.path.exists(phpPath): + os.remove(phpPath) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php84-php-fpm' + else: + phpService = f"php8.4-fpm" + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + + phpPath = ApacheVhost.DecidePHPPath('85', virtualHostName) + if os.path.exists(phpPath): + os.remove(phpPath) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + phpService = f'php85-php-fpm' + else: + phpService = f"php8.5-fpm" + + command = f"systemctl restart {phpService}" + ProcessUtilities.normalExecutioner(command) + @staticmethod def changePHP(phpVersion, vhFile): try: @@ -564,6 +602,9 @@ def changePHP(phpVersion, vhFile): child = ChildDomains.objects.get(domain=virtualHostName) externalApp = child.master.externalApp + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f"PHP version before getPHPString: {phpVersion}") + php = PHPManager.getPHPString(phpVersion) finalConfPath = ApacheVhost.DecidePHPPath(php, virtualHostName) diff --git a/plogical/vhost.py b/plogical/vhost.py index b73329db9..10d110115 100755 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -633,7 +633,7 @@ def changePHP(vhFile, phpVersion): from plogical.phpUtilities import phpUtilities - phpVersion = phpUtilities.FindIfSaidPHPIsAvaiableOtherwiseMaketheNextOneAvailableToUse(vhFile, phpVersion) + phpVersion = phpUtilities.FindIfSaidPHPIsAvaiableOtherwiseMaketheNextOneAvailableToUse(None, phpVersion) phpDetachUpdatePath = '/home/%s/.lsphp_restart.txt' % (vhFile.split('/')[-2]) if ProcessUtilities.decideServer() == ProcessUtilities.OLS: