diff --git a/install.sh b/install.sh index 095d903e9..c90ff6941 100644 --- a/install.sh +++ b/install.sh @@ -14,6 +14,11 @@ yum update curl wget ca-certificates -y 1> /dev/null elif echo $OUTPUT | grep -q "CloudLinux 7" ; then echo "Checking and installing curl and wget" yum install curl wget -y 1> /dev/null +yum update curl wget ca-certificates -y 1> /dev/null + SERVER_OS="CloudLinux" +elif echo $OUTPUT | grep -q "CloudLinux 8" ; then + echo "Checking and installing curl and wget" +yum install curl wget -y 1> /dev/null yum update curl wget ca-certificates -y 1> /dev/null SERVER_OS="CloudLinux" elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then diff --git a/install/install.py b/install/install.py index 8fe180987..bd84fc23a 100755 --- a/install/install.py +++ b/install/install.py @@ -136,68 +136,70 @@ class preFlightsChecks: def mountTemp(self): try: - ## On OpenVZ there is an issue using .tempdisk for /tmp as it breaks network on container after reboot. + # ## On OpenVZ there is an issue using .tempdisk for /tmp as it breaks network on container after reboot. + # + # if subprocess.check_output('systemd-detect-virt').decode("utf-8").find("openvz") > -1: + # + # varTmp = "/var/tmp /tmp none bind 0 0\n" + # + # fstab = "/etc/fstab" + # writeToFile = open(fstab, "a") + # writeToFile.writelines(varTmp) + # writeToFile.close() + # + # else: + # + # command = "dd if=/dev/zero of=/usr/.tempdisk bs=100M count=15" + # preFlightsChecks.call(command, self.distro, command, + # command, + # 1, 0, os.EX_OSERR) + # + # command = "mkfs.ext4 -F /usr/.tempdisk" + # preFlightsChecks.call(command, self.distro, command, + # command, + # 1, 0, os.EX_OSERR) + # + # command = "mkdir -p /usr/.tmpbak/" + # preFlightsChecks.call(command, self.distro, command, + # command, + # 1, 0, os.EX_OSERR) + # + # command = "cp -pr /tmp/* /usr/.tmpbak/" + # subprocess.call(command, shell=True) + # + # command = "mount -o loop,rw,nodev,nosuid,noexec,nofail /usr/.tempdisk /tmp" + # preFlightsChecks.call(command, self.distro, command, + # command, + # 1, 0, os.EX_OSERR) + # + # command = "chmod 1777 /tmp" + # preFlightsChecks.call(command, self.distro, command, + # command, + # 1, 0, os.EX_OSERR) + # + # command = "cp -pr /usr/.tmpbak/* /tmp/" + # subprocess.call(command, shell=True) + # + # command = "rm -rf /usr/.tmpbak" + # preFlightsChecks.call(command, self.distro, command, + # command, + # 1, 0, os.EX_OSERR) + # + # command = "mount --bind /tmp /var/tmp" + # preFlightsChecks.call(command, self.distro, command, + # command, + # 1, 0, os.EX_OSERR) + # + # tmp = "/usr/.tempdisk /tmp ext4 loop,rw,noexec,nosuid,nodev,nofail 0 0\n" + # varTmp = "/tmp /var/tmp none bind 0 0\n" + # + # fstab = "/etc/fstab" + # writeToFile = open(fstab, "a") + # writeToFile.writelines(tmp) + # writeToFile.writelines(varTmp) + # writeToFile.close() - if subprocess.check_output('systemd-detect-virt').decode("utf-8").find("openvz") > -1: - - varTmp = "/var/tmp /tmp none bind 0 0\n" - - fstab = "/etc/fstab" - writeToFile = open(fstab, "a") - writeToFile.writelines(varTmp) - writeToFile.close() - - else: - - command = "dd if=/dev/zero of=/usr/.tempdisk bs=100M count=15" - preFlightsChecks.call(command, self.distro, command, - command, - 1, 0, os.EX_OSERR) - - command = "mkfs.ext4 -F /usr/.tempdisk" - preFlightsChecks.call(command, self.distro, command, - command, - 1, 0, os.EX_OSERR) - - command = "mkdir -p /usr/.tmpbak/" - preFlightsChecks.call(command, self.distro, command, - command, - 1, 0, os.EX_OSERR) - - command = "cp -pr /tmp/* /usr/.tmpbak/" - subprocess.call(command, shell=True) - - command = "mount -o loop,rw,nodev,nosuid,noexec,nofail /usr/.tempdisk /tmp" - preFlightsChecks.call(command, self.distro, command, - command, - 1, 0, os.EX_OSERR) - - command = "chmod 1777 /tmp" - preFlightsChecks.call(command, self.distro, command, - command, - 1, 0, os.EX_OSERR) - - command = "cp -pr /usr/.tmpbak/* /tmp/" - subprocess.call(command, shell=True) - - command = "rm -rf /usr/.tmpbak" - preFlightsChecks.call(command, self.distro, command, - command, - 1, 0, os.EX_OSERR) - - command = "mount --bind /tmp /var/tmp" - preFlightsChecks.call(command, self.distro, command, - command, - 1, 0, os.EX_OSERR) - - tmp = "/usr/.tempdisk /tmp ext4 loop,rw,noexec,nosuid,nodev,nofail 0 0\n" - varTmp = "/tmp /var/tmp none bind 0 0\n" - - fstab = "/etc/fstab" - writeToFile = open(fstab, "a") - writeToFile.writelines(tmp) - writeToFile.writelines(varTmp) - writeToFile.close() + pass except BaseException as msg: preFlightsChecks.stdOut('[ERROR] ' + str(msg)) diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index 73f955098..8794648be 100755 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -204,6 +204,9 @@ class InstallCyberPanel: command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp81*' os.system(command) + command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp82*' + os.system(command) + elif self.distro == centos: command = 'yum -y groupinstall lsphp-all' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) @@ -241,7 +244,7 @@ class InstallCyberPanel: command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* --exclude lsphp73-pecl-zip --exclude *imagick* -y --skip-broken' subprocess.call(command, shell=True) - command = 'dnf install lsphp81* --exclude *imagick* -y --skip-broken' + command = 'dnf install lsphp81* lsphp82* --exclude *imagick* -y --skip-broken' subprocess.call(command, shell=True) if self.distro == openeuler: diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index 54c3ba268..caa07c140 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -70,7 +70,7 @@ class cPanelImporter: if value[2] == 'main': self.MainSite = value self.PHPVersion = value[9] - self.InheritPHP = self.PHPDecider(key) + self.InheritPHP = self.PHPDecider(None) else: self.OtherDomainNames.append(key) self.OtherDomains.append(value) @@ -119,7 +119,10 @@ class cPanelImporter: from plogical.phpUtilities import phpUtilities - completePathToConfigFile = f'/usr/local/lsws/conf/vhosts/{domainName}/vhost.conf' + if domainName !=None: + completePathToConfigFile = f'/usr/local/lsws/conf/vhosts/{domainName}/vhost.conf' + else: + completePathToConfigFile = None phpVersion = phpUtilities.FindIfSaidPHPIsAvaiableOtherwiseMaketheNextOneAvailableToUse(completePathToConfigFile, self.PHPVersion) @@ -225,7 +228,7 @@ class cPanelImporter: logging.statusWriter(self.logFile, message, 1) self.PHPVersion = self.MainSite[9] - self.PHPDecider(self.mainDomain) + self.PHPDecider(None) message = 'PHP version of %s is %s.' % (DomainName, self.PHPVersion) logging.statusWriter(self.logFile, message, 1) @@ -270,7 +273,7 @@ class cPanelImporter: if result[0] == 1: pass else: - message = 'Failed to create main site %s from archive file: %s' % (DomainName, self.backupFile) + message = f'Failed to create main site %s from archive file: %s. Error {str(result)}' % (DomainName, self.backupFile) logging.statusWriter(self.logFile, message, 1) return 0 @@ -373,7 +376,7 @@ class cPanelImporter: ## Find PHP Version self.PHPVersion = self.OtherDomains[counter][9] - self.PHPDecider(items) + self.PHPDecider(None) message = 'Calling core to create %s.' % (items) logging.statusWriter(self.logFile, message, 1) diff --git a/plogical/phpUtilities.py b/plogical/phpUtilities.py index fc642d25b..801c461b9 100755 --- a/plogical/phpUtilities.py +++ b/plogical/phpUtilities.py @@ -242,13 +242,23 @@ class phpUtilities: @staticmethod def FindIfSaidPHPIsAvaiableOtherwiseMaketheNextOneAvailableToUse(vhFile, phpVersion): - result = phpUtilities.GetPHPVersionFromFile(vhFile) + if vhFile != None: + result = phpUtilities.GetPHPVersionFromFile(vhFile) - if os.path.exists(result): - return phpVersion + if os.path.exists(result): + return phpVersion + else: + from managePHP.phpManager import PHPManager + return PHPManager.findPHPVersions()[-2] else: from managePHP.phpManager import PHPManager - return PHPManager.findPHPVersions()[-2] + php = PHPManager.getPHPString(phpVersion) + finalPath = f'/usr/local/lsws/lsphp{php}/bin/php' + if os.path.exists(finalPath): + return phpVersion + else: + from managePHP.phpManager import PHPManager + return PHPManager.findPHPVersions()[-2] diff --git a/plogical/test.py b/plogical/test.py index d63776954..e69de29bb 100644 --- a/plogical/test.py +++ b/plogical/test.py @@ -1,30 +0,0 @@ -import os - -def find_php_versions(): - import re - import os - php_versions = [] - lsws_directory = "/usr/local/lsws" - - if os.path.exists(lsws_directory): - for dir_name in os.listdir(lsws_directory): - full_path = os.path.join(lsws_directory, dir_name) - if os.path.isdir(full_path) and dir_name.startswith("lsphp"): - php_version = dir_name.replace("lsphp", "PHP ").replace("", ".") - php_versions.append(php_version) - - result_list = [] - for item in sorted(php_versions): - # Use regular expression to find numbers in the string - numbers = re.findall(r'\d+', item) - - # Join the numbers with dots and add 'PHP' back to the string - result = 'PHP ' + '.'.join(numbers) - - result_list.append(result) - - return result_list - -if __name__ == "__main__": - php_versions = find_php_versions() - print(php_versions)