This commit is contained in:
usmannasir
2023-11-26 14:32:35 +04:00
parent f41f07d8f2
commit 6a4e63bf93
7 changed files with 223 additions and 55 deletions

View File

@@ -12,14 +12,30 @@ class PHPManager:
@staticmethod
def findPHPVersions():
distro = ProcessUtilities.decideDistro()
if distro == ProcessUtilities.centos:
return ['PHP 5.3', 'PHP 5.4', 'PHP 5.5', 'PHP 5.6', 'PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
elif distro == ProcessUtilities.cent8:
return ['PHP 7.1','PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
elif distro == ProcessUtilities.ubuntu20:
return ['PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
else:
# distro = ProcessUtilities.decideDistro()
# if distro == ProcessUtilities.centos:
# return ['PHP 5.3', 'PHP 5.4', 'PHP 5.5', 'PHP 5.6', 'PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
# elif distro == ProcessUtilities.cent8:
# return ['PHP 7.1','PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
# elif distro == ProcessUtilities.ubuntu20:
# return ['PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
# else:
# return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
try:
# Run the shell command and capture the output
result = ProcessUtilities.outputExecutioner('ls -la /usr/local/lsws')
# Get the lines containing 'lsphp' in the output
lsphp_lines = [line for line in result.split('\n') if 'lsphp' in line]
# Extract the version from the lines and format it as 'PHP x.y'
php_versions = ['PHP ' + line.split()[8][5] + '.' + line.split()[8][6:] for line in lsphp_lines]
# Now php_versions contains the formatted PHP versions
return php_versions
except BaseException as msg:
return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
@staticmethod