php manager for ubuntu

This commit is contained in:
usmannasir
2018-11-14 13:36:34 +05:00
parent fe24761937
commit d38ce8a053
9 changed files with 226 additions and 779 deletions

View File

@@ -18,6 +18,7 @@ from plogical.mailUtilities import mailUtilities
from plogical.website import WebsiteManager
from loginSystem.models import ACL
from plogical.acl import ACLManager
from firewall.models import FirewallRules
# Create your views here.
@@ -560,9 +561,57 @@ def changeAdminPassword(request):
ACLManager.createDefaultACLs()
acl = ACL.objects.get(name='admin')
email = 'usman@cyberpersons.com'
admin = Administrator(userName="admin", password=adminPass, type=1, email=email,
admin = Administrator(userName="admin", password=hashPassword.hash_password(adminPass), type=1, email=email,
firstName="Cyber", lastName="Panel", acl=acl)
admin.save()
vers = version(currentVersion="1.7", build=3)
vers.save()
package = Package(admin=admin, packageName="Default", diskSpace=1000,
bandwidth=1000, ftpAccounts=1000, dataBases=1000,
emailAccounts=1000, allowedDomains=20)
package.save()
newFWRule = FirewallRules(name="panel", proto="tcp", port="8090")
newFWRule.save()
newFWRule = FirewallRules(name="http", proto="tcp", port="80")
newFWRule.save()
newFWRule = FirewallRules(name="https", proto="tcp", port="443")
newFWRule.save()
newFWRule = FirewallRules(name="ftp", proto="tcp", port="21")
newFWRule.save()
newFWRule = FirewallRules(name="smtp", proto="tcp", port="25")
newFWRule.save()
newFWRule = FirewallRules(name="smtps", proto="tcp", port="587")
newFWRule.save()
newFWRule = FirewallRules(name="ssmtp", proto="tcp", port="465")
newFWRule.save()
newFWRule = FirewallRules(name="pop3", proto="tcp", port="110")
newFWRule.save()
newFWRule = FirewallRules(name="imap", proto="tcp", port="143")
newFWRule.save()
newFWRule = FirewallRules(name="simap", proto="tcp", port="993")
newFWRule.save()
newFWRule = FirewallRules(name="dns", proto="udp", port="53")
newFWRule.save()
newFWRule = FirewallRules(name="dnstcp", proto="tcp", port="53")
newFWRule.save()
newFWRule = FirewallRules(name="ftptls", proto="tcp", port="40110-40210")
newFWRule.save()
data_ret = {"changed": 1,
'error_message': "None"}
json_data = json.dumps(data_ret)

View File

@@ -1368,6 +1368,7 @@ class preFlightsChecks:
writeDataToFile.writelines(dataWritten)
else:
writeDataToFile.writelines(items)
#if self.distro == ubuntu:
# os.fchmod(writeDataToFile.fileno(), stat.S_IRUSR | stat.S_IWUSR)
@@ -1405,6 +1406,7 @@ class preFlightsChecks:
writeDataToFile.writelines(dataWritten)
else:
writeDataToFile.writelines(items)
#if self.distro == ubuntu:
# os.fchmod(writeDataToFile.fileno(), stat.S_IRUSR | stat.S_IWUSR)
@@ -2379,30 +2381,6 @@ class preFlightsChecks:
os.chdir(self.cwd)
if self.distro == ubuntu:
fd = open('/etc/systemd/system/lscpd.service','w')
fd.write('[Unit]\n')
fd.write('Description = LSCPD Daemon\n')
fd.write('After=network.target remote-fs.target nss-lookup.target\n')
fd.write('\n')
fd.write('[Service]\n')
fd.write('Type=forking\n')
fd.write('ExecStart = /usr/local/lscp/bin/lscpdctrl start\n')
fd.write('ExecStop = /usr/local/lscp/bin/lscpdctrl stop\n')
fd.write('#ExecReload = /usr/local/lscp/bin/lscpdctrl restart\n')
fd.write('\n')
fd.write('KillMode=none\n')
fd.write('PrivateTmp=false\n')
fd.write('\n')
fd.write('# Do not want to be limited in any way\n')
fd.write('CPUAccounting=false\n')
fd.write('TasksAccounting=false\n')
fd.write('MemoryAccounting=false\n')
fd.write('\n')
fd.write('[Install]\n')
fd.write('WantedBy=default.target\n')
fd.close()
else:
shutil.copy("lscpd/lscpd.service","/etc/systemd/system/lscpd.service")
shutil.copy("lscpd/lscpdctrl","/usr/local/lscp/bin/lscpdctrl")
@@ -2431,6 +2409,7 @@ class preFlightsChecks:
count = 1
while(1):
command = 'systemctl enable lscpd.service'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -2907,6 +2886,8 @@ class preFlightsChecks:
command = 'mkdir -p /etc/opendkim/keys/'
subprocess.call(shlex.split(command))
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
@@ -2934,8 +2915,6 @@ InternalHosts refile:/etc/opendkim/TrustedHosts
writeToFile = open(openDKIMConfigurePath,'a')
writeToFile.write(configData)
if self.distro == ubuntu:
writeToFile.write('Socket inet:8891@127.0.0.1\n')
writeToFile.close()
@@ -2953,17 +2932,6 @@ milter_default_action = accept
writeToFile.write(configData)
writeToFile.close()
if self.distro == ubuntu:
writeToFile = open('/etc/default/opendkim','r')
lines = writeToFile.readlines()
writeToFile.close()
writeToFile = open('/etc/default/opendkim','w')
for line in lines:
if line[:6] == "SOCKET":
line = '#' + line
writeToFile.write(line)
writeToFile.write('SOCKET="inet:8891@127.0.0.1"\n')
writeToFile.close()
#### Restarting Postfix and OpenDKIM
@@ -3313,6 +3281,14 @@ milter_default_action = accept
logging.InstallLog.writeToFile(str(msg) + " [enableDisableEmail]")
return 0
@staticmethod
def setUpFirstAccount():
try:
command = 'python /usr/local/CyberCP/plogical/adminPass.py --password 1234567'
subprocess.call(shlex.split(command))
except:
pass
def get_distro():
distro = -1
distro_file = ""
@@ -3491,7 +3467,7 @@ def main():
else:
preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.")
checks.enableDisableFTP('On', distro)
checks.setUpFirstAccount()
logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")
checks.installation_successfull()

View File

@@ -949,6 +949,7 @@ class InstallCyberPanel:
#if self.distro == ubuntu:
# os.fchmod(writeDataToFile.fileno(), stat.S_IRUSR | stat.S_IWUSR)
writeDataToFile.close()
#if self.distro == ubuntu:
@@ -1127,6 +1128,7 @@ class InstallCyberPanel:
writeDataToFile.writelines(dataWritten)
else:
writeDataToFile.writelines(items)
#if self.distro == ubuntu:
# os.fchmod(writeDataToFile.fileno(), stat.S_IRUSR | stat.S_IWUSR)

View File

@@ -1,12 +1,20 @@
[Unit]
Description = LSCPD Daemon
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart = /usr/local/lscp/bin/lscpdctrl start
ExecStop = /usr/local/lscp/bin/lscpdctrl stop
Restart= /usr/local/lscp/bin/lscpdctrl restart
Restart=on-abnormal
#ExecReload= /usr/local/lscp/bin/lscpdctrl restart
KillMode=none
PrivateTmp=false
# do not want to be limited in anyway
CPUAccounting=false
TasksAccounting=false
MemoryAccounting=false
[Install]
WantedBy=default.target

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render,redirect
from django.shortcuts import render
from django.http import HttpResponse
from models import Administrator
from plogical import hashPassword

View File

@@ -1080,326 +1080,28 @@ def installExtensions(request):
### ################ #################
php70 = PHP.objects.get(phpVers="php70")
phpVersion = PHP.objects.get(phpVers="php70")
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-bcmath",
description="A module for PHP applications for using the bcmath library",
status=1)
phpPath = ''
phpExtension.save()
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
phpPath = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'php70.xml')
else:
phpPath = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp70.xml')
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-common",
description="Common files for PHP",
status=1)
php = ElementTree.parse(phpPath)
phpExtension.save()
phpExtensions = php.findall('extension')
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-dba",
description="A database abstraction layer module for PHP applications",
status=1)
for extension in phpExtensions:
extensionName = extension.find('extensionName').text
extensionDescription = extension.find('extensionDescription').text
status = int(extension.find('status').text)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-enchant",
description="Human Language and Character Encoding Support",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-gd",
description="A module for PHP applications for using the gd graphics library",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-gmp",
description="A module for PHP applications for using the GNU MP library",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-imap",
description="A module for PHP applications that use IMAP",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-intl",
description="Internationalization extension for PHP application",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-json",
description="LSPHP70 Json PHP Extension",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-ldap",
description="A module for PHP applications that use LDAP",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-mbstring",
description="A module for PHP applications which need multi-byte string handling",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-mcrypt",
description="Standard PHP module provides mcrypt library support",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-mysqlnd",
description="A module for PHP applications that use MySQL databases",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-odbc",
description="A module for PHP applications that use ODBC databases",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pdo",
description="A database access abstraction module for PHP applications",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pear",
description="PHP Extension and Application Repository framework",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pgsql",
description="A PostgreSQL database module for PHP",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-process",
description="Modules for PHP script using system process interfaces",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pspell",
description="A module for PHP applications for using pspell interfaces",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-recode",
description="A module for PHP applications for using the recode library",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-snmp",
description="A module for PHP applications that query SNMP-managed devices",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-soap",
description="A module for PHP applications that use the SOAP protocol",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-tidy",
description="Standard PHP module provides tidy library support",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-xml",
description="A module for PHP applications which use XML",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-xmlrpc",
description="A module for PHP applications which use the XML-RPC protocol",
status=1)
phpExtension.save()
## non-active packages
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-debuginfo",
description="Debug information for package lsphp70",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-dbg",
description="The interactive PHP debugger",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-mysql56-debuginfo",
description="Debug information for package lsphp70-mysql56",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-lsphp53-devel",
description="Files needed for building PHP extensions",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-mysql56",
description="PHP scripting language for creating dynamic web sites",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-opcache",
description="The Zend OPcache",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-sqlite",
description="Extension for the SQLite V2 Embeddable SQL Database Engine",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-xcache",
description="PHP accelerator, optimizer, encoder and dynamic content cacher",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-xcache-admin",
description="XCache Administration",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-apcu",
description="APC User Cache",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-apcu-devel",
description="APCu developer files (header)",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-apcu-panel",
description="APCu control panel",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-igbinary",
description="Replacement for the standard PHP serializer",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-igbinary-debuginfo",
description="Debug information for package lsphp70-pecl-igbinary",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-igbinary-devel",
description="Igbinary developer files (header)",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-memcache",
description="Extension to work with the Memcached caching daemon",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-memcached",
description="Extension to work with the Memcached caching daemon",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-msgpack",
description="API for communicating with MessagePack serialization",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-pecl-redis",
description="Extension for communicating with the Redis key-value store",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php70,
extensionName="lsphp70-zip",
description="ZIP archive management extension for PHP",
status=0)
phpExtension = installedPackages(phpVers=phpVersion,
extensionName=extensionName,
description=extensionDescription,
status=status)
phpExtension.save()
@@ -1409,323 +1111,28 @@ def installExtensions(request):
### ################ #################
php71 = PHP.objects.get(phpVers="php71")
phpVersion = PHP.objects.get(phpVers="php71")
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-bcmath",
description="A module for PHP applications for using the bcmath library",
status=1)
phpPath = ''
phpExtension.save()
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
phpPath = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'php71.xml')
else:
phpPath = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp71.xml')
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-common",
description="Common files for PHP",
status=1)
php = ElementTree.parse(phpPath)
phpExtension.save()
phpExtensions = php.findall('extension')
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-dba",
description="A database abstraction layer module for PHP applications",
status=1)
for extension in phpExtensions:
extensionName = extension.find('extensionName').text
extensionDescription = extension.find('extensionDescription').text
status = int(extension.find('status').text)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-enchant",
description="Human Language and Character Encoding Support",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-gd",
description="A module for PHP applications for using the gd graphics library",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-gmp",
description="A module for PHP applications for using the GNU MP library",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-imap",
description="A module for PHP applications that use IMAP",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-intl",
description="Internationalization extension for PHP application",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-json",
description="LSPHP71 Json PHP Extension",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-ldap",
description="A module for PHP applications that use LDAP",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-mbstring",
description="A module for PHP applications which need multi-byte string handling",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-mcrypt",
description="Standard PHP module provides mcrypt library support",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-mysqlnd",
description="A module for PHP applications that use MySQL databases",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-odbc",
description="A module for PHP applications that use ODBC databases",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pdo",
description="A database access abstraction module for PHP applications",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pear",
description="PHP Extension and Application Repository framework",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pgsql",
description="A PostgreSQL database module for PHP",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-process",
description="Modules for PHP script using system process interfaces",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pspell",
description="A module for PHP applications for using pspell interfaces",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-recode",
description="A module for PHP applications for using the recode library",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-snmp",
description="A module for PHP applications that query SNMP-managed devices",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-soap",
description="A module for PHP applications that use the SOAP protocol",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-tidy",
description="Standard PHP module provides tidy library support",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-xml",
description="A module for PHP applications which use XML",
status=1)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-xmlrpc",
description="A module for PHP applications which use the XML-RPC protocol",
status=1)
phpExtension.save()
## non-active packages
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-debuginfo",
description="Debug information for package lsphp71",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-dbg",
description="The interactive PHP debugger",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-mysql56-debuginfo",
description="Debug information for package lsphp71-mysql56",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-lsphp53-devel",
description="Files needed for building PHP extensions",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-mysql56",
description="PHP scripting language for creating dynamic web sites",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-opcache",
description="The Zend OPcache",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-sqlite",
description="Extension for the SQLite V2 Embeddable SQL Database Engine",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-xcache",
description="PHP accelerator, optimizer, encoder and dynamic content cacher",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-xcache-admin",
description="XCache Administration",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-apcu",
description="APC User Cache",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-apcu-devel",
description="APCu developer files (header)",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-apcu-panel",
description="APCu control panel",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-igbinary",
description="Replacement for the standard PHP serializer",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-igbinary-debuginfo",
description="Debug information for package lsphp71-pecl-igbinary",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-igbinary-devel",
description="Igbinary developer files (header)",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-memcache",
description="Extension to work with the Memcached caching daemon",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-memcached",
description="Extension to work with the Memcached caching daemon",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-msgpack",
description="API for communicating with MessagePack serialization",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-pecl-redis",
description="Extension for communicating with the Redis key-value store",
status=0)
phpExtension.save()
phpExtension = installedPackages(phpVers=php71,
extensionName="lsphp71-zip",
description="ZIP archive management extension for PHP",
status=0)
phpExtension = installedPackages(phpVers=phpVersion,
extensionName=extensionName,
description=extensionDescription,
status=status)
phpExtension.save()
@@ -1734,14 +1141,18 @@ def installExtensions(request):
newPHP72 = PHP(phpVers="php72")
newPHP72.save()
extensionDetailsPath = os.path.join('/usr','local','CyberCP','managePHP','php72.xml')
php72Path = ''
php72 = ElementTree.parse(extensionDetailsPath)
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
php72Path = os.path.join('/usr','local','CyberCP','managePHP','php72.xml')
else:
php72Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp72.xml')
php72 = ElementTree.parse(php72Path)
php72Extensions = php72.findall('extension')
for extension in php72Extensions:
extensionName = extension.find('extensionName').text
extensionDescription = extension.find('extensionDescription').text
status = int(extension.find('status').text)

View File

@@ -26,6 +26,17 @@ class Upgrade:
print ("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n")
@staticmethod
def executioner(command):
try:
res = subprocess.call(shlex.split(command))
if res == 0:
return 1
else:
return 0
except:
return 0
@staticmethod
def downloadLink():
try:
@@ -42,7 +53,7 @@ class Upgrade:
@staticmethod
def setupVirtualEnv():
try:
Upgrade.stdOut('Setting up virtual enviroment for CyberPanel.')
Upgrade.stdOut('Setting up virtual environment for CyberPanel.')
##
count = 0
while (1):
@@ -112,27 +123,21 @@ class Upgrade:
if res == 1:
count = count + 1
Upgrade.stdOut(
"Trying to install project dependant modules, trying again, try number: " + str(count))
Upgrade.stdOut("Trying to install project dependant modules, trying again, try number: " + str(count))
if count == 3:
Upgrade.stdOut(
"Failed to install project dependant modules! [setupVirtualEnv]")
Upgrade.stdOut("Failed to install project dependant modules! [setupVirtualEnv]")
os._exit(0)
break
else:
Upgrade.stdOut("Project dependant modules installed successfully!!")
break
try:
command = "systemctl stop gunicorn.socket"
subprocess.call(shlex.split(command))
except:
pass
try:
command = "systemctl stop gunicorn.socket"
Upgrade.executioner(command)
command = "virtualenv --system-site-packages /usr/local/CyberCP"
subprocess.call(shlex.split(command))
except:
pass
Upgrade.executioner(command)
Upgrade.stdOut('Virtual enviroment for CyberPanel successfully installed.')
@@ -143,24 +148,9 @@ class Upgrade:
@staticmethod
def upgradeOpenLiteSpeed():
try:
##
count = 0
while (1):
command = "yum upgrade -y openlitespeed"
res = subprocess.call(shlex.split(command))
if res == 1:
count = count + 1
Upgrade.stdOut(
"Trying to upgrade OpenLiteSpeed, trying again, try number: " + str(count))
if count == 3:
Upgrade.stdOut("Failed to upgrade OpenLiteSpeed! [upgradeOpenLiteSpeed]")
else:
Upgrade.stdOut("OpenLiteSpeed successfully upgraded!")
break
##
if Upgrade.executioner(command) == 1:
Upgrade.stdOut('OpenLiteSpeed Upgraded.')
except OSError, msg:
Upgrade.stdOut(str(msg) + " [upgradeOpenLiteSpeed]")
os._exit(0)
@@ -214,25 +204,31 @@ WantedBy=multi-user.target"""
def fileManager():
## Copy File manager files
command = "rm -rf /usr/local/lsws/Example/html/FileManager"
Upgrade.executioner(command)
if os.path.exists('/usr/local/lsws/bin/openlitespeed'):
count = 1
while (1):
command = "rm -rf /usr/local/lsws/Example/html/FileManager"
command = "mv /usr/local/CyberCP/install/FileManager /usr/local/lsws/Example/html"
res = subprocess.call(shlex.split(command))
if res == 1:
count = count + 1
Upgrade.stdOut(
"Trying to remove old File manager files, try number: " + str(count))
"Trying to upgrade File manager, try number: " + str(count))
if count == 3:
Upgrade.stdOut("Failed to remove old File manager files! [upgrade]")
Upgrade.stdOut("Failed to upgrade File manager! [upgrade]")
os._exit(0)
else:
Upgrade.stdOut("Old File Manager files successfully removed!")
Upgrade.stdOut("File manager successfully upgraded!")
break
else:
count = 1
while (1):
command = "mv /usr/local/CyberCP/install/FileManager /usr/local/lsws/Example/html"
command = "mv /usr/local/CyberCP/install/FileManager /usr/local/lsws"
res = subprocess.call(shlex.split(command))
if res == 1:
@@ -255,25 +251,15 @@ WantedBy=multi-user.target"""
@staticmethod
def setupCLI():
try:
try:
command = "ln -s /usr/local/CyberCP/cli/cyberPanel.py /usr/bin/cyberpanel"
subprocess.call(shlex.split(command))
except:
pass
try:
command = "ln -s /usr/local/CyberCP/cli/cyberPanel.py /usr/bin/cyberpanel"
Upgrade.executioner(command)
command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py"
subprocess.call(shlex.split(command))
except:
pass
Upgrade.executioner(command)
except OSError, msg:
try:
command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py"
subprocess.call(shlex.split(command))
except:
pass
Upgrade.stdOut(str(msg) + " [setupCLI]")
return 0
@@ -458,16 +444,31 @@ WantedBy=multi-user.target"""
def emailMarketingMigrationsa():
try:
os.chdir('/usr/local/CyberCP')
try:
command = "python manage.py makemigrations emailMarketing"
subprocess.call(shlex.split(command))
except:
pass
try:
Upgrade.executioner(command)
data = open('/usr/local/CyberCP/emailMarketing/migrations/0001_initial.py', 'r').readline()
writeToFile = open('/usr/local/CyberCP/emailMarketing/migrations/0001_initial.py', 'w')
skipCheck = 0
for items in data:
if items.find('dependencies') > -1:
skipCheck = 1
if items.find(']') > -1 and skipCheck == 1:
skipCheck = 0
continue
if skipCheck == 0:
writeToFile.writelines(items)
writeToFile.close()
command = "python manage.py migrate emailMarketing"
subprocess.call(shlex.split(command))
except:
pass
Upgrade.executioner(command)
except:
pass
@@ -540,6 +541,7 @@ WantedBy=multi-user.target"""
break
## Copy settings file
data = open("/usr/local/settings.py", 'r').readlines()
pluginCheck = 1
@@ -552,6 +554,11 @@ WantedBy=multi-user.target"""
if items.find('emailMarketing') > -1:
emailMarketing = 0
emailPremium = 1
for items in data:
if items.find('emailPremium') > -1:
emailPremium = 0
Upgrade.stdOut('Restoring settings file!')
@@ -565,7 +572,7 @@ WantedBy=multi-user.target"""
writeToFile.writelines(" 'pluginHolder',\n")
if emailMarketing == 1:
writeToFile.writelines(" 'emailMarketing',\n")
if Version.currentVersion == '1.6':
if emailPremium == 1:
writeToFile.writelines(" 'emailPremium',\n")
else:
writeToFile.writelines(items)
@@ -584,7 +591,6 @@ WantedBy=multi-user.target"""
except:
pass
@staticmethod
def installPYDNS():
try:
@@ -736,16 +742,11 @@ WantedBy=multi-user.target"""
Version = version.objects.get(pk=1)
try:
command = "systemctl stop gunicorn.socket"
subprocess.call(shlex.split(command))
except:
pass
try:
Upgrade.executioner(command)
command = "systemctl stop lscpd"
subprocess.call(shlex.split(command))
except:
pass
Upgrade.executioner(command)
##
@@ -775,19 +776,19 @@ WantedBy=multi-user.target"""
##
Upgrade.setupVirtualEnv()
Upgrade.updateGunicornConf()
##
Upgrade.applyLoginSystemMigrations()
Upgrade.enableServices()
## Upgrade OpenLiteSpeed
if os.path.exists('/usr/local/lsws/bin/openlitespeed'):
Upgrade.upgradeOpenLiteSpeed()
Upgrade.setupCLI()
Upgrade.installLSCPD()
time.sleep(3)

View File

@@ -203,7 +203,7 @@ class ServerStatusUtil:
return 0
if os.path.exists('/etc/letsencrypt/live/' + virtualHostName):
sslUtilities.installSSLForDomain(virtualHostUtilities, website.adminEmail)
sslUtilities.installSSLForDomain(virtualHostName, website.master.adminEmail)
vhostPath = vhost.Server_root + "/conf/vhosts"
FNULL = open(os.devnull, 'w')