mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
dynamically get php extensions
This commit is contained in:
@@ -1290,26 +1290,34 @@ def getExtensionsInformation(request):
|
|||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
phpVers = data['phpSelection']
|
phpVers = data['phpSelection']
|
||||||
|
|
||||||
phpVers = "php" + PHPManager.getPHPString(phpVers)
|
phpVers = f"lsphp{PHPManager.getPHPString(phpVers)}"
|
||||||
|
|
||||||
php = PHP.objects.get(phpVers=phpVers)
|
# php = PHP.objects.get(phpVers=phpVers)
|
||||||
|
|
||||||
records = php.installedpackages_set.all()
|
if os.path.exists('/etc/lsb-release'):
|
||||||
|
command = f'apt list | grep {phpVers}'
|
||||||
|
|
||||||
|
result = ProcessUtilities.outputExecutioner(command).split('\n')
|
||||||
|
|
||||||
|
#records = php.installedpackages_set.all()
|
||||||
|
|
||||||
json_data = "["
|
json_data = "["
|
||||||
checker = 0
|
checker = 0
|
||||||
|
counter = 1
|
||||||
|
|
||||||
for items in records:
|
for items in result:
|
||||||
|
|
||||||
if items.status == 0:
|
if items.find(phpVers) > -1:
|
||||||
|
|
||||||
|
if items.find('installed') == -1:
|
||||||
status = "Not-Installed"
|
status = "Not-Installed"
|
||||||
else:
|
else:
|
||||||
status = "Installed"
|
status = "Installed"
|
||||||
|
|
||||||
dic = {'id': items.id,
|
dic = {'id': counter,
|
||||||
'phpVers': items.phpVers.phpVers,
|
'phpVers': phpVers,
|
||||||
'extensionName': items.extensionName,
|
'extensionName': items.split('/')[0],
|
||||||
'description': items.description,
|
'description': items,
|
||||||
'status': status
|
'status': status
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1318,6 +1326,7 @@ def getExtensionsInformation(request):
|
|||||||
checker = 1
|
checker = 1
|
||||||
else:
|
else:
|
||||||
json_data = json_data + ',' + json.dumps(dic)
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
counter += 1
|
||||||
|
|
||||||
json_data = json_data + ']'
|
json_data = json_data + ']'
|
||||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||||
|
|||||||
@@ -2157,7 +2157,6 @@ $parameters = array(
|
|||||||
statusFile.close()
|
statusFile.close()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def DeploytoProduction(self):
|
def DeploytoProduction(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user