diff --git a/install/installLog.py b/install/installLog.py index 58a3ed2c7..ec0e1b58a 100755 --- a/install/installLog.py +++ b/install/installLog.py @@ -7,7 +7,7 @@ import requests class InstallLog: fileName = "/var/log/installLogs.txt" currentPercent = '10' - LogURL = 'https://cloud.cyberpanel.net/servers/RecvData' + LogURL = 'https://platform.cyberpersons.com/servers/RecvData' ServerIP = '' @staticmethod diff --git a/managePHP/views.py b/managePHP/views.py index aa4711d2a..779752e5b 100755 --- a/managePHP/views.py +++ b/managePHP/views.py @@ -1290,34 +1290,71 @@ 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}' + 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') + + #records = php.installedpackages_set.all() json_data = "[" checker = 0 + counter = 1 - for items in records: + for items in result: + if os.path.exists('/etc/lsb-release'): + if items.find(phpVers) > -1: + if items.find('installed') == -1: + status = "Not-Installed" + else: + status = "Installed" - if items.status == 0: - status = "Not-Installed" + dic = {'id': counter, + 'phpVers': phpVers, + 'extensionName': items.split('/')[0], + 'description': items, + '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: - status = "Installed" + ResultExt = items.split(' ') + extesnion = ResultExt[0] - dic = {'id': items.id, - 'phpVers': items.phpVers.phpVers, - 'extensionName': items.extensionName, - 'description': items.description, - 'status': status - } + if extesnion.find(phpVers) > -1: + if resultInstalled.find(extesnion) == -1: + status = "Not-Installed" + else: + status = "Installed" - if checker == 0: - json_data = json_data + json.dumps(dic) - checker = 1 - else: - json_data = json_data + ',' + json.dumps(dic) + dic = {'id': counter, + 'phpVers': phpVers, + 'extensionName': extesnion, + 'description': items, + 'status': status + } + + + if checker == 0: + json_data = json_data + json.dumps(dic) + 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}) @@ -1410,14 +1447,14 @@ def getRequestStatus(request): command = "sudo rm -f " + phpUtilities.installLogPath ProcessUtilities.executioner(command) - if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1: - ext = installedPackages.objects.get(extensionName=extensionName) - ext.status = 1 - ext.save() - else: - ext = installedPackages.objects.get(extensionName=extensionName) - ext.status = 0 - ext.save() + # if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1: + # ext = installedPackages.objects.get(extensionName=extensionName) + # ext.status = 1 + # ext.save() + # else: + # ext = installedPackages.objects.get(extensionName=extensionName) + # ext.status = 0 + # ext.save() final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1, 'error_message': "None", @@ -1429,15 +1466,15 @@ def getRequestStatus(request): command = "sudo rm -f " + phpUtilities.installLogPath ProcessUtilities.executioner(command) - if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1: - ext = installedPackages.objects.get(extensionName=extensionName) - ext.status = 1 - ext.save() - - else: - ext = installedPackages.objects.get(extensionName=extensionName) - ext.status = 0 - ext.save() + # if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1: + # ext = installedPackages.objects.get(extensionName=extensionName) + # ext.status = 1 + # ext.save() + # + # else: + # ext = installedPackages.objects.get(extensionName=extensionName) + # ext.status = 0 + # ext.save() final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1, 'error_message': "None", @@ -1449,15 +1486,15 @@ def getRequestStatus(request): command = "sudo rm -f " + phpUtilities.installLogPath ProcessUtilities.executioner(command) - if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1: - ext = installedPackages.objects.get(extensionName=extensionName) - ext.status = 1 - ext.save() - - else: - ext = installedPackages.objects.get(extensionName=extensionName) - ext.status = 0 - ext.save() + # if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1: + # ext = installedPackages.objects.get(extensionName=extensionName) + # ext.status = 1 + # ext.save() + # + # else: + # ext = installedPackages.objects.get(extensionName=extensionName) + # ext.status = 0 + # ext.save() final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1, 'error_message': "None", @@ -1469,9 +1506,9 @@ def getRequestStatus(request): command = "sudo rm -f " + phpUtilities.installLogPath ProcessUtilities.executioner(command) - ext = installedPackages.objects.get(extensionName=extensionName) - ext.status = 0 - ext.save() + # ext = installedPackages.objects.get(extensionName=extensionName) + # ext.status = 0 + # ext.save() final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1, 'error_message': "None", diff --git a/plogical/ClusterManager.py b/plogical/ClusterManager.py index d9df35733..4c27c327b 100644 --- a/plogical/ClusterManager.py +++ b/plogical/ClusterManager.py @@ -16,8 +16,8 @@ from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging from plogical.mysqlUtilities import mysqlUtilities class ClusterManager: - LogURL = "https://cloud.cyberpanel.net/HighAvailability/RecvData" - UptimeURL = "https://cloud.cyberpanel.net/servers/UptimeReport" + LogURL = "https://platform.cyberpersons.com/HighAvailability/RecvData" + UptimeURL = "https://platform.cyberpersons.com/servers/UptimeReport" ClusterFile = '/home/cyberpanel/cluster' CloudConfig = '/home/cyberpanel/cloud' vhostConfPath = '/usr/local/lsws/conf/vhosts' diff --git a/plogical/CyberPanelUpgrade.py b/plogical/CyberPanelUpgrade.py index 6f1833c2e..a9179374b 100644 --- a/plogical/CyberPanelUpgrade.py +++ b/plogical/CyberPanelUpgrade.py @@ -9,7 +9,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") class UpgradeCyberPanel: - LogURL = "https://cloud.cyberpanel.net/settings/RecvData" + LogURL = "https://platform.cyberpersons.com/settings/RecvData" def __init__(self, branch, mail, dns, ftp): ipFile = "/etc/cyberpanel/machineIP" diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index d501fcc46..a742302e6 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -2156,7 +2156,6 @@ $parameters = array( statusFile.close() return 0 - def DeploytoProduction(self): try: diff --git a/plogical/test.py b/plogical/test.py index e69de29bb..43397b4b2 100644 --- a/plogical/test.py +++ b/plogical/test.py @@ -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' '))