Skip to content

Commit

Permalink
feature: support upto php 8.4 on apache manager
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Sep 27, 2024
1 parent 8bfe914 commit 44f7c7e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
41 changes: 41 additions & 0 deletions ApachController/ApacheVhosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plogical/vhost.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 44f7c7e

Please sign in to comment.