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) 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})

View File

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