Merge branch 'v1.7.2-plugin' of https://github.com/usmannasir/cyberpanel into v1.7.2-plugin

This commit is contained in:
rperper
2018-11-14 08:38:06 -05:00
5 changed files with 62 additions and 77 deletions

View File

@@ -1006,7 +1006,6 @@ class preFlightsChecks:
preFlightsChecks.stdOut("Owner for '/usr/local/CyberCP' successfully changed!")
break
def install_unzip(self):
self.stdOut("Install zip")
try:
@@ -2076,6 +2075,21 @@ class preFlightsChecks:
command = "sed -i 's/auth_mechanisms = plain/#auth_mechanisms = plain/g' /etc/dovecot/conf.d/10-auth.conf"
subprocess.call(shlex.split(command))
## Ubuntu 18.10 ssl_dh for dovecot 2.3.2.1
if get_Ubuntu_release() == 18.10:
dovecotConf = '/etc/dovecot/dovecot.conf'
data = open(dovecotConf, 'r').readlines()
writeToFile = open(dovecotConf, 'w')
for items in data:
if items.find('ssl_key = <key.pem') > -1:
writeToFile.writelines(items)
writeToFile.writelines('ssl_dh = </usr/share/dovecot/dh.pem\n')
else:
writeToFile.writelines(items)
writeToFile.close()
command = "systemctl restart dovecot"
subprocess.call(shlex.split(command))
@@ -2880,14 +2894,18 @@ class preFlightsChecks:
break
if self.distro == ubuntu:
command = 'apt install opendkim-tools'
subprocess.call(shlex.split(command))
try:
command = 'apt install opendkim-tools'
subprocess.call(shlex.split(command))
except:
pass
command = 'mkdir -p /etc/opendkim/keys/'
subprocess.call(shlex.split(command))
try:
command = 'mkdir -p /etc/opendkim/keys/'
subprocess.call(shlex.split(command))
except:
pass
command = "sed -i 's/Socket local:/var/run/opendkim/opendkim.sock/Socket inet:8891@localhost/g' /etc/opendkim.conf"
subprocess.call(shlex.split(command))
except OSError, msg:
logging.InstallLog.writeToFile(str(msg) + " [installOpenDKIM]")
return 0
@@ -2932,6 +2950,16 @@ milter_default_action = accept
writeToFile.write(configData)
writeToFile.close()
if self.distro == ubuntu:
data = open(openDKIMConfigurePath, 'r').readlines()
writeToFile = open(openDKIMConfigurePath, 'w')
for items in data:
if items.find('Socket') > -1 and items.find('local:') and items[0] != '#':
writeToFile.writelines('Socket inet:8891@localhost\n')
else:
writeToFile.writelines(items)
writeToFile.close()
#### Restarting Postfix and OpenDKIM

View File

@@ -307,7 +307,6 @@ class InstallCyberPanel:
count = 0
while (1):
if self.distro == ubuntu:
command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install ' \
'lsphp7? lsphp7?-common lsphp7?-curl lsphp7?-dev lsphp7?-imap lsphp7?-intl lsphp7?-json ' \
@@ -315,7 +314,7 @@ class InstallCyberPanel:
'lsphp7?-sqlite3 lsphp7?-tidy'
res = os.system(command)
else:
command = 'yum -y groupinstall lsphp-all'
command = 'yum -y install lsphp*'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -332,47 +331,6 @@ class InstallCyberPanel:
logging.InstallLog.writeToFile("LiteSpeed PHPs successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHPs successfully installed!")
## only php 71
if self.distro == centos:
count = 0
while (1):
command = 'yum install lsphp71 lsphp71-json lsphp71-xmlrpc lsphp71-xml lsphp71-tidy lsphp71-soap lsphp71-snmp lsphp71-recode lsphp71-pspell lsphp71-process lsphp71-pgsql lsphp71-pear lsphp71-pdo lsphp71-opcache lsphp71-odbc lsphp71-mysqlnd lsphp71-mcrypt lsphp71-mbstring lsphp71-ldap lsphp71-intl lsphp71-imap lsphp71-gmp lsphp71-gd lsphp71-enchant lsphp71-dba lsphp71-common lsphp71-bcmath -y'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
count = count + 1
InstallCyberPanel.stdOut(
"Trying to install LiteSpeed PHP 7.1, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile(
"Failed to install LiteSpeed PHP 7.1, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHP 7.1 successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHP 7.1 successfully installed!")
break
## only php 72
count = 0
while (1):
command = 'yum install -y lsphp72 lsphp72-json lsphp72-xmlrpc lsphp72-xml lsphp72-tidy lsphp72-soap lsphp72-snmp lsphp72-recode lsphp72-pspell lsphp72-process lsphp72-pgsql lsphp72-pear lsphp72-pdo lsphp72-opcache lsphp72-odbc lsphp72-mysqlnd lsphp72-mcrypt lsphp72-mbstring lsphp72-ldap lsphp72-intl lsphp72-imap lsphp72-gmp lsphp72-gd lsphp72-enchant lsphp72-dba lsphp72-common lsphp72-bcmath'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
count = count + 1
InstallCyberPanel.stdOut(
"Trying to install LiteSpeed PHP 7.1, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile(
"Failed to install LiteSpeed PHP 7.1, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHP 7.1 successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHP 7.1 successfully installed!")
break
## break for outer loop
break

View File

@@ -1355,14 +1355,9 @@ def getRequestStatus(request):
return HttpResponse(final_json)
elif requestStatus.find("PHP Extension Removed") > -1:
if subprocess.check_output(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()
ext = installedPackages.objects.get(extensionName=extensionName)
ext.status = 0
ext.save()
installUtilities.reStartLiteSpeed()
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,

View File

@@ -25,21 +25,21 @@ class phpUtilities:
cmd = shlex.split(command)
with open(phpUtilities.installLogPath, 'w') as f:
res = subprocess.call(cmd, stdout=f)
try:
with open(phpUtilities.installLogPath, 'w') as f:
subprocess.call(cmd, stdout=f)
if res == 1:
writeToFile = open(phpUtilities.installLogPath, 'a')
writeToFile.writelines("PHP Extension Installed.\n")
writeToFile.close()
return 1
except:
writeToFile = open(phpUtilities.installLogPath, 'a')
writeToFile.writelines("Can not be installed.\n")
writeToFile.close()
logging.CyberCPLogFileWriter.writeToFile("[Could not Install]")
return 0
else:
writeToFile = open(phpUtilities.installLogPath, 'a')
writeToFile.writelines("PHP Extension Installed.\n")
writeToFile.close()
return 1
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installPHPExtension]")
@@ -56,21 +56,22 @@ class phpUtilities:
cmd = shlex.split(command)
with open(phpUtilities.installLogPath, 'w') as f:
res = subprocess.call(cmd, stdout=f)
try:
if res == 1:
with open(phpUtilities.installLogPath, 'w') as f:
subprocess.call(cmd, stdout=f)
writeToFile = open(phpUtilities.installLogPath, 'a')
writeToFile.writelines("PHP Extension Removed.\n")
writeToFile.close()
return 1
except:
writeToFile = open(phpUtilities.installLogPath, 'a')
writeToFile.writelines("Can not un-install Extension.\n")
writeToFile.close()
logging.CyberCPLogFileWriter.writeToFile("[Could not Install]")
return 0
else:
writeToFile = open(phpUtilities.installLogPath, 'a')
writeToFile.writelines("PHP Extension Removed.\n")
writeToFile.close()
return 1
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[unInstallPHPExtension]")

View File

@@ -987,7 +987,11 @@ class WebsiteManager:
json_data = json.dumps(dic)
return HttpResponse(json_data)
cronPath = "/var/spool/cron/" + website.externalApp
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
cronPath = "/var/spool/cron/" + website.externalApp
else:
cronPath = "/var/spool/cron/crontabs/" + website.externalApp
cmd = 'sudo test -e ' + cronPath + ' && echo Exists'
output = os.popen(cmd).read()
@@ -996,7 +1000,6 @@ class WebsiteManager:
final_json = json.dumps(data_ret)
return HttpResponse(final_json)
cronPath = "/var/spool/cron/" + website.externalApp
crons = []
try: