From 5e362b704d0213c737177f067f135116a6591963 Mon Sep 17 00:00:00 2001 From: usmannasir <01-134132-158@student.bahria.edu.pk> Date: Sun, 4 Mar 2018 13:37:58 +0500 Subject: [PATCH] PHP 7.2 Support. --- install/install.py | 2 + managePHP/php72.xml | 257 ++++++++++++++++++ .../templates/managePHP/editPHPConfig.html | 2 + .../managePHP/installExtensions.html | 1 + managePHP/views.py | 40 +++ plogical/domain.xml | 86 ------ plogical/test.py | 29 -- plogical/virtualHostUtilities.py | 8 +- .../websiteFunctions/createWebsite.html | 1 + .../websiteFunctions/modifyWebsite.html | 1 + .../templates/websiteFunctions/website.html | 5 +- websiteFunctions/views.py | 2 - 12 files changed, 315 insertions(+), 119 deletions(-) create mode 100644 managePHP/php72.xml diff --git a/install/install.py b/install/install.py index e90263a7d..d02d06870 100644 --- a/install/install.py +++ b/install/install.py @@ -12,6 +12,8 @@ import time class preFlightsChecks: + cyberPanelMirror = "mirror.cyberpanel.net" + def __init__(self,rootPath,ip,path,cwd,cyberPanelPath): self.ipAddr = ip self.path = path diff --git a/managePHP/php72.xml b/managePHP/php72.xml new file mode 100644 index 000000000..0b486f731 --- /dev/null +++ b/managePHP/php72.xml @@ -0,0 +1,257 @@ + + + php72 + + + lsphp72-debuginfo + Debug information for package lsphp72 + 0 + + + + lsphp72-pecl-igbinary-debuginfo + Debug information for package lsphp72-pecl-igbinary + 0 + + + + lsphp72-pecl-mcrypt-debuginfo + LSPHP72 lsphp72-pecl-mcrypt-debuginfo Extension + 0 + + + + lsphp72-bcmath + A extension for PHP applications for using the bcmath library. + 1 + + + + lsphp72-common + Common files for PHP. + 1 + + + + lsphp72-dba + A database abstraction layer extension for PHP applications. + 1 + + + + lsphp72-devel + Files needed for building PHP extensions. + 0 + + + + lsphp72-enchant + Enchant spelling extension for PHP applications. + 1 + + + + lsphp72-gd + A extension for PHP applications for using the gd graphics library. + 1 + + + + lsphp72-gmp + A extension for PHP applications for using the GNU MP library. + 1 + + + + lsphp72-imap + A extension for PHP applications that use IMAP. + 1 + + + + lsphp72-intl + Internationalization extension for PHP applications. + 1 + + + + lsphp72-json + LSPHP72 Json PHP Extension + 1 + + + + lsphp72-ldap + A extension for PHP applications that use LDAP. + 1 + + + + lsphp72-mbstring + A extension for PHP applications which need multi-byte string handling. + 1 + + + + lsphp72-mysqlnd + A extension for PHP applications that use MySQL databases. + 1 + + + + lsphp72-odbc + A extension for PHP applications that use ODBC databases. + 1 + + + + lsphp72-opcache + The Zend OPcache. + 1 + + + + lsphp72-pdo + A database access abstraction extension for PHP applications. + 1 + + + + lsphp72-pear + PHP Extension and Application Repository framework. + 1 + + + + lsphp72-pecl-apcu + APC User Cache. + 0 + + + + lsphp72-pecl-apcu-devel + APCu developer files (header). + 0 + + + + lsphp72-pecl-apcu-panel + APCu control panel. + 0 + + + + lsphp72-pecl-igbinary + Replacement for the standard PHP serializer. + 0 + + + + lsphp72-pecl-igbinary-devel + Igbinary developer files (header). + 0 + + + + lsphp72-pecl-mcrypt + LSPHP72 lsphp72-pecl-mcrypt Extension. + 0 + + + + lsphp72-pecl-memcache + Extension to work with the Memcached caching daemon. + 0 + + + + lsphp72-pecl-memcached + Extension to work with the Memcached caching daemon. + 0 + + + + lsphp72-pecl-msgpack + API for communicating with MessagePack serialization. + 0 + + + + lsphp72-pecl-msgpack-devel + MessagePack developer files (header). + 0 + + + + lsphp72-pecl-redis + Extension for communicating with the Redis key-value store. + 0 + + + + lsphp72-pgsql + A PostgreSQL database extension for PHP. + 1 + + + + lsphp72-process + extensions for PHP script using system process interfaces. + 1 + + + + lsphp72-pspell + A extension for PHP applications for using pspell interfaces. + 1 + + + + lsphp72-recode + A extension for PHP applications for using the recode library. + 1 + + + + lsphp72-snmp + A extension for PHP applications that query SNMP-managed devices. + 1 + + + + lsphp72-soap + A extension for PHP applications that use the SOAP protocol. + 1 + + + + lsphp72-tidy + Standard PHP extension provides tidy library support. + 1 + + + + lsphp72-xml + Standard PHP extension provides tidy library support. + 1 + + + + lsphp72-xmlrpc + A extension for PHP applications which use the XML-RPC protocol. + 1 + + + + lsphp72-zip + LSPHP72 Json PHP Extension + 0 + + + + lsphp72-mcrypt + Standard PHP extension provides mcrypt library support. + 1 + + + \ No newline at end of file diff --git a/managePHP/templates/managePHP/editPHPConfig.html b/managePHP/templates/managePHP/editPHPConfig.html index 8d0252c04..2a84b3891 100644 --- a/managePHP/templates/managePHP/editPHPConfig.html +++ b/managePHP/templates/managePHP/editPHPConfig.html @@ -54,6 +54,7 @@ + @@ -187,6 +188,7 @@ + diff --git a/managePHP/templates/managePHP/installExtensions.html b/managePHP/templates/managePHP/installExtensions.html index b6868a1ae..392fc1e42 100644 --- a/managePHP/templates/managePHP/installExtensions.html +++ b/managePHP/templates/managePHP/installExtensions.html @@ -34,6 +34,7 @@ + diff --git a/managePHP/views.py b/managePHP/views.py index d41d09599..ef68ded21 100644 --- a/managePHP/views.py +++ b/managePHP/views.py @@ -21,6 +21,7 @@ import subprocess import shlex import plogical.CyberCPLogFileWriter as logging from random import randint +from xml.etree import ElementTree # Create your views here. @@ -28,6 +29,11 @@ def loadPHPHome(request): try: val = request.session['userID'] + admin = Administrator.objects.get(pk=val) + + if admin.type == 3: + return HttpResponse("You don't have enough priviliges to access this page.") + return render(request,'managePHP/index.html') except KeyError: return redirect(loadLoginPage) @@ -1725,6 +1731,30 @@ def installExtensions(request): phpExtension.save() + if PHP.objects.count() == 6: + + newPHP72 = PHP(phpVers="php72") + newPHP72.save() + + extensionDetailsPath = os.path.join('/usr','local','CyberCP','managePHP','php72.xml') + + php72 = ElementTree.parse(extensionDetailsPath) + + php72Extensions = php72.findall('extension') + + for extension in php72Extensions: + + extensionName = extension.find('extensionName').text + extensionDescription = extension.find('extensionDescription').text + status = int(extension.find('status').text) + + phpExtension = installedPackages(phpVers=newPHP72, + extensionName=extensionName, + description=extensionDescription, + status=status) + + phpExtension.save() + return render(request,'managePHP/installExtensions.html') except KeyError: return redirect(loadLoginPage) @@ -1752,6 +1782,8 @@ def getExtensionsInformation(request): phpVers = "php70" elif phpVers == "PHP 7.1": phpVers = "php71" + elif phpVers == "PHP 7.2": + phpVers = "php72" php = PHP.objects.get(phpVers=phpVers) @@ -1965,6 +1997,8 @@ def getCurrentPHPConfig(request): phpVers = "php70" elif phpVers == "PHP 7.1": phpVers = "php71" + elif phpVers == "PHP 7.2": + phpVers = "php72" path = "/usr/local/lsws/ls"+phpVers+"/etc/php.ini" @@ -2085,6 +2119,8 @@ def savePHPConfigBasic(request): phpVers = "php70" elif phpVers == "PHP 7.1": phpVers = "php71" + elif phpVers == "PHP 7.2": + phpVers = "php72" ## @@ -2140,6 +2176,8 @@ def getCurrentAdvancedPHPConfig(request): phpVers = "php70" elif phpVers == "PHP 7.1": phpVers = "php71" + elif phpVers == "PHP 7.2": + phpVers = "php72" path = "/usr/local/lsws/ls"+phpVers+"/etc/php.ini" @@ -2180,6 +2218,8 @@ def savePHPConfigAdvance(request): phpVers = "php70" elif phpVers == "PHP 7.1": phpVers = "php71" + elif phpVers == "PHP 7.2": + phpVers = "php72" path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini" diff --git a/plogical/domain.xml b/plogical/domain.xml index b1f43d87e..e69de29bb 100644 --- a/plogical/domain.xml +++ b/plogical/domain.xml @@ -1,86 +0,0 @@ - - - cybertronproject.com - PHP 7.1 - cybertr - - - usman.com - PHP 7.0 - /home/cybertronproject.com/public_html/usman.com - - - - - LdH8eQ5j4T7lUw - LdH8eQ5j4T7lUw - *C8FF97B66E672C39EA314B6F1FF1991950AA4D94 - - - - - SOA - cybertronproject.com - ns1.cybertronproject.com hostmaster.cybertronproject.com 1 10800 3600 604800 3600 - 0 - - - NS - cybertronproject.com - ns1.cybertronproject.com - 0 - - - A - ns1.cybertronproject.com - 139.59.214.173 - 0 - - - NS - cybertronproject.com - ns2.cybertronproject.com - 0 - - - A - ns2.cybertronproject.com - 139.59.214.173 - 0 - - - A - cybertronproject.com - 139.59.214.173 - 0 - - - A - mail.cybertronproject.com - 139.59.214.173 - 0 - - - MX - cybertronproject.com - mail.cybertronproject.com - 10 - - - SPF - cybertronproject.com - v=spf1 a mx ip4:139.59.214.173 ?all - 0 - - - - - rehan@cybertronproject.com - rehan - - - usman@cybertronproject.com - 9xvps - - - \ No newline at end of file diff --git a/plogical/test.py b/plogical/test.py index 3cd95373f..e69de29bb 100644 --- a/plogical/test.py +++ b/plogical/test.py @@ -1,29 +0,0 @@ -import subprocess -import time - -class CyberCPLogFileWriter: - fileName = "/home/cyberpanel.net/public_html/hello.txt" - - @staticmethod - def writeToFile(message): - try: - file = open(CyberCPLogFileWriter.fileName,'a') - file.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] "+ message + "\n") - file.close() - except IOError,msg: - return "Can not write to error file." - - @staticmethod - def readLastNFiles(numberOfLines,fileName): - try: - - lastFewLines = subprocess.check_output(["tail", "-n",str(numberOfLines),fileName]) - - return lastFewLines - - except subprocess.CalledProcessError,msg: - return "File was empty" - - -CyberCPLogFileWriter.writeToFile("Hello") \ No newline at end of file diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py index 51d314715..2ce230f7f 100644 --- a/plogical/virtualHostUtilities.py +++ b/plogical/virtualHostUtilities.py @@ -31,7 +31,7 @@ class virtualHostUtilities: ## adding user - command = "adduser "+virtualHostUser + " -M" + command = "adduser "+virtualHostUser + " -M -d " + path cmd = shlex.split(command) @@ -213,6 +213,8 @@ class virtualHostUtilities: php = "70" elif phpVersion == "PHP 7.1": php = "71" + elif phpVersion == "PHP 7.2": + php = "72" extprocessor = "extprocessor "+virtualHostUser+" {\n" type = " type lsapi\n" @@ -498,6 +500,8 @@ class virtualHostUtilities: php = "70" elif phpVersion == "PHP 7.1": php = "71" + elif phpVersion == "PHP 7.2": + php = "72" extprocessor = "extprocessor " + virtualHostUser+sockRandomPath + " {\n" @@ -695,6 +699,8 @@ class virtualHostUtilities: finalphp = 70 elif phpVersion == "PHP 7.1": finalphp = 71 + elif phpVersion == "PHP 7.2": + finalphp = 72 writeDataToFile = open(vhFile,"w") diff --git a/websiteFunctions/templates/websiteFunctions/createWebsite.html b/websiteFunctions/templates/websiteFunctions/createWebsite.html index eeb40227d..e97204c67 100644 --- a/websiteFunctions/templates/websiteFunctions/createWebsite.html +++ b/websiteFunctions/templates/websiteFunctions/createWebsite.html @@ -74,6 +74,7 @@ + diff --git a/websiteFunctions/templates/websiteFunctions/modifyWebsite.html b/websiteFunctions/templates/websiteFunctions/modifyWebsite.html index 7e185e08d..2349b0942 100644 --- a/websiteFunctions/templates/websiteFunctions/modifyWebsite.html +++ b/websiteFunctions/templates/websiteFunctions/modifyWebsite.html @@ -80,6 +80,7 @@ + diff --git a/websiteFunctions/templates/websiteFunctions/website.html b/websiteFunctions/templates/websiteFunctions/website.html index 01f59b4a8..0e7f562f6 100644 --- a/websiteFunctions/templates/websiteFunctions/website.html +++ b/websiteFunctions/templates/websiteFunctions/website.html @@ -284,7 +284,7 @@ - {% trans "Cron Job" %} + {% trans "Cron Jobs" %} @@ -329,6 +329,7 @@ + @@ -456,6 +457,7 @@ + @@ -719,6 +721,7 @@ + diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index 126fc335b..48a276c26 100644 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -891,8 +891,6 @@ def saveWebsiteChanges(request): execPath = execPath + " changePHP --phpVersion '" + phpVersion + "' --path " + completePathToConfigFile - - output = subprocess.check_output(shlex.split(execPath)) if output.find("1,None") > -1: