diff --git a/CLScript/CloudLinuxDomains.py b/CLScript/CloudLinuxDomains.py index 3357cfd5e..b46b9cb14 100755 --- a/CLScript/CloudLinuxDomains.py +++ b/CLScript/CloudLinuxDomains.py @@ -49,13 +49,12 @@ class CloudLinuxDomains(CLMain): "is_main": True, "php": { "version": php[:2], - "ini_path": f"/usr/local/lsws/lsphp{php[:2]}/etc/php.d ", + "ini_path": f"/usr/local/lsws/lsphp{php[:2]}/etc/php.d", "is_native": False } } - for webs in webs.childdomains_set.all(): completePathToConfigFile = f'/usr/local/lsws/conf/vhosts/{webs.domain}/vhost.conf' from plogical.phpUtilities import phpUtilities @@ -68,7 +67,7 @@ class CloudLinuxDomains(CLMain): "is_main": False, "php": { "version": php[:2], - "ini_path": f"/usr/local/lsws/lsphp{php[:2]}/etc/php.d ", + "ini_path": f"/usr/local/lsws/lsphp{php[:2]}/etc/php.d", "is_native": False } diff --git a/dockerManager/dockerInstall.py b/dockerManager/dockerInstall.py index 0891f98b9..c2f1b3e6a 100755 --- a/dockerManager/dockerInstall.py +++ b/dockerManager/dockerInstall.py @@ -20,10 +20,10 @@ class DockerInstall: if ProcessUtilities.decideDistro() == ProcessUtilities.cent8: - command = 'dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo' + command = 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo' ServerStatusUtil.executioner(command, statusFile) - command = 'sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin --nobest' + command = 'sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin --allowerasing -y' elif ProcessUtilities.decideDistro() == ProcessUtilities.centos: command = 'sudo yum install -y docker' else: diff --git a/managePHP/phpManager.py b/managePHP/phpManager.py index e54d345b8..be91ea612 100755 --- a/managePHP/phpManager.py +++ b/managePHP/phpManager.py @@ -1,3 +1,5 @@ +import os.path + from plogical.processUtilities import ProcessUtilities import json import re @@ -28,12 +30,19 @@ class PHPManager: # Get the lines containing 'lsphp' in the output lsphp_lines = [line for line in result.split('\n') if 'lsphp' in line] + # Extract the version from the lines and format it as 'PHP x.y' php_versions = ['PHP ' + line.split()[8][5] + '.' + line.split()[8][6:] for line in lsphp_lines] + if os.path.exists(ProcessUtilities.debugPath): + from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging + logging.writeToFile(f'Found PHP versions in findPHPVersions: {php_versions}') + # Now php_versions contains the formatted PHP versions return php_versions except BaseException as msg: + from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging + logging.writeToFile(f'Error while finding php versions on system: {str(msg)}') return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] @staticmethod diff --git a/plogical/test.py b/plogical/test.py index e69de29bb..a380f501a 100644 --- a/plogical/test.py +++ b/plogical/test.py @@ -0,0 +1,36 @@ +import sys +sys.path.append('/usr/local/CyberCP') +from plogical.processUtilities import ProcessUtilities + + +def findPHPVersions(): + # distro = ProcessUtilities.decideDistro() + # if distro == ProcessUtilities.centos: + # return ['PHP 5.3', 'PHP 5.4', 'PHP 5.5', 'PHP 5.6', 'PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] + # elif distro == ProcessUtilities.cent8: + # return ['PHP 7.1','PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] + # elif distro == ProcessUtilities.ubuntu20: + # return ['PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] + # else: + # return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] + + try: + + # Run the shell command and capture the output + result = ProcessUtilities.outputExecutioner('ls -la /usr/local/lsws') + + # Get the lines containing 'lsphp' in the output + lsphp_lines = [line for line in result.split('\n') if 'lsphp' in line] + print(lsphp_lines) + + # Extract the version from the lines and format it as 'PHP x.y' + php_versions = ['PHP ' + line.split()[8][5] + '.' + line.split()[8][6:] for line in lsphp_lines] + print(php_versions) + + # Now php_versions contains the formatted PHP versions + return php_versions + except BaseException as msg: + print(str(msg)) + return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] + +findPHPVersions() \ No newline at end of file