mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
dynamically get php extensions centos/alma
This commit is contained in:
@@ -1296,6 +1296,11 @@ def getExtensionsInformation(request):
|
|||||||
|
|
||||||
if os.path.exists('/etc/lsb-release'):
|
if os.path.exists('/etc/lsb-release'):
|
||||||
command = f'apt list | grep {phpVers}'
|
command = f'apt list | grep {phpVers}'
|
||||||
|
else:
|
||||||
|
command = 'yum list installed'
|
||||||
|
resultInstalled = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
|
command = f'yum list | grep {phpVers} | xargs -n3 | column -t'
|
||||||
|
|
||||||
result = ProcessUtilities.outputExecutioner(command).split('\n')
|
result = ProcessUtilities.outputExecutioner(command).split('\n')
|
||||||
|
|
||||||
@@ -1306,9 +1311,8 @@ def getExtensionsInformation(request):
|
|||||||
counter = 1
|
counter = 1
|
||||||
|
|
||||||
for items in result:
|
for items in result:
|
||||||
|
if os.path.exists('/etc/lsb-release'):
|
||||||
if items.find(phpVers) > -1:
|
if items.find(phpVers) > -1:
|
||||||
|
|
||||||
if items.find('installed') == -1:
|
if items.find('installed') == -1:
|
||||||
status = "Not-Installed"
|
status = "Not-Installed"
|
||||||
else:
|
else:
|
||||||
@@ -1321,6 +1325,30 @@ def getExtensionsInformation(request):
|
|||||||
'status': status
|
'status': status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if checker == 0:
|
||||||
|
json_data = json_data + json.dumps(dic)
|
||||||
|
checker = 1
|
||||||
|
else:
|
||||||
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
counter += 1
|
||||||
|
else:
|
||||||
|
ResultExt = items.split(' ')
|
||||||
|
extesnion = ResultExt[0]
|
||||||
|
|
||||||
|
if extesnion.find(phpVers) > -1:
|
||||||
|
if resultInstalled.find(extesnion) == -1:
|
||||||
|
status = "Not-Installed"
|
||||||
|
else:
|
||||||
|
status = "Installed"
|
||||||
|
|
||||||
|
dic = {'id': counter,
|
||||||
|
'phpVers': phpVers,
|
||||||
|
'extensionName': extesnion,
|
||||||
|
'description': items,
|
||||||
|
'status': status
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if checker == 0:
|
if checker == 0:
|
||||||
json_data = json_data + json.dumps(dic)
|
json_data = json_data + json.dumps(dic)
|
||||||
checker = 1
|
checker = 1
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import subprocess, shlex
|
||||||
|
command = 'yum list | grep lsphp | xargs -n3 | column -t'
|
||||||
|
result = subprocess.check_output(command, shell=True).splitlines()
|
||||||
|
for item in result:
|
||||||
|
print(item.split(b' '))
|
||||||
|
|||||||
Reference in New Issue
Block a user