Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feature: add php8
  • Loading branch information
usmannasir committed Dec 2, 2020
1 parent 693c38e commit 4fb8268
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
14 changes: 13 additions & 1 deletion install/installCyberPanel.py
Expand Up @@ -192,6 +192,15 @@ def installAllPHPVersions(self):
if res != 0:
InstallCyberPanel.stdOut("Failed to install PHP on Ubuntu.", 1, 1)

command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install ' \
'lsphp8? lsphp8?-common lsphp8?-curl lsphp8?-dev lsphp8?-imap lsphp8?-intl lsphp8?-json ' \
'lsphp8?-ldap lsphp8?-mysql lsphp8?-opcache lsphp8?-pspell lsphp8?-recode ' \
'lsphp8?-sqlite8 lsphp8?-tidy'

res = os.system(command)
if res != 0:
InstallCyberPanel.stdOut("Failed to install PHP on Ubuntu.", 1, 1)

elif self.distro == centos:
command = 'yum -y groupinstall lsphp-all'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
Expand Down Expand Up @@ -232,8 +241,11 @@ def installAllPHPVersions(self):

install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)

command = 'yum install lsphp80*'
subprocess.call(command, shell=True)

if self.distro == cent8:
command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* --exclude lsphp73-pecl-zip -y'
command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* --exclude lsphp73-pecl-zip -y'
subprocess.call(command, shell=True)

def installMySQL(self, mysql):
Expand Down
10 changes: 6 additions & 4 deletions managePHP/phpManager.py
Expand Up @@ -13,13 +13,13 @@ class PHPManager:
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']
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']
elif distro == ProcessUtilities.cent8:
return ['PHP 7.1','PHP 7.2', 'PHP 7.3', 'PHP 7.4']
return ['PHP 7.1','PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0']
elif distro == ProcessUtilities.ubuntu20:
return ['PHP 7.2', 'PHP 7.3', 'PHP 7.4']
return ['PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0']
else:
return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4']
return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0']

@staticmethod
def getPHPString(phpVersion):
Expand All @@ -42,6 +42,8 @@ def getPHPString(phpVersion):
php = "73"
elif phpVersion == "PHP 7.4":
php = "74"
elif phpVersion == "PHP 8.0":
php = "80"

return php

Expand Down
11 changes: 11 additions & 0 deletions plogical/upgrade.py
Expand Up @@ -1939,13 +1939,24 @@ def installPHP73():

Upgrade.executioner(command, 'Install PHP 74, 0')

if Upgrade.installedOutput.find('lsphp80') == -1:
command = 'yum install lsphp80*'
subprocess.call(command, shell=True)

except:
command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install ' \
'lsphp7? lsphp7?-common lsphp7?-curl lsphp7?-dev lsphp7?-imap lsphp7?-intl lsphp7?-json ' \
'lsphp7?-ldap lsphp7?-mysql lsphp7?-opcache lsphp7?-pspell lsphp7?-recode ' \
'lsphp7?-sqlite3 lsphp7?-tidy'
Upgrade.executioner(command, 'Install PHP 73, 0')

command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install ' \
'lsphp8? lsphp8?-common lsphp8?-curl lsphp8?-dev lsphp8?-imap lsphp8?-intl lsphp8?-json ' \
'lsphp8?-ldap lsphp8?-mysql lsphp8?-opcache lsphp8?-pspell lsphp8?-recode ' \
'lsphp8?-sqlite8 lsphp8?-tidy'

Upgrade.executioner(command, 'Install PHP 80, 0')

CentOSPath = '/etc/redhat-release'

if not os.path.exists(CentOSPath):
Expand Down

0 comments on commit 4fb8268

Please sign in to comment.