dynamically get php extensions

This commit is contained in:
Usman Nasir
2022-06-12 14:09:57 +05:00
parent e94441ffbc
commit 87d58a50a1
2 changed files with 28 additions and 20 deletions

View File

@@ -1290,26 +1290,34 @@ def getExtensionsInformation(request):
data = json.loads(request.body)
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 = "["
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"
else:
status = "Installed"
dic = {'id': items.id,
'phpVers': items.phpVers.phpVers,
'extensionName': items.extensionName,
'description': items.description,
dic = {'id': counter,
'phpVers': phpVers,
'extensionName': items.split('/')[0],
'description': items,
'status': status
}
@@ -1318,6 +1326,7 @@ def getExtensionsInformation(request):
checker = 1
else:
json_data = json_data + ',' + json.dumps(dic)
counter += 1
json_data = json_data + ']'
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})

View File

@@ -2157,7 +2157,6 @@ $parameters = array(
statusFile.close()
return 0
def DeploytoProduction(self):
try: