From f69840d0b9d1e1ea91e5ed0e4f3f96467fa5cfed Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sat, 28 Jun 2025 18:56:48 +0500 Subject: [PATCH] add support for ubuntu 24 --- CyberCP/settings.py | 19 ------------------- install/install.py | 9 ++++++--- plogical/acl.py | 16 ++++++++-------- plogical/mailUtilities.py | 8 ++++---- plogical/mysqlUtilities.py | 2 +- plogical/vhostConfs.py | 8 ++++---- requirments.txt | 1 - websiteFunctions/website.py | 8 ++++---- 8 files changed, 27 insertions(+), 44 deletions(-) diff --git a/CyberCP/settings.py b/CyberCP/settings.py index 8958a012f..0226e657c 100644 --- a/CyberCP/settings.py +++ b/CyberCP/settings.py @@ -10,25 +10,6 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ -# Fix for botocore.vendored.six.moves import error -import sys -try: - import six -except ImportError: - pass -else: - # Create a compatibility shim for botocore.vendored - if 'botocore' not in sys.modules: - import botocore - if not hasattr(sys.modules.get('botocore', None), 'vendored'): - import types - vendored = types.ModuleType('vendored') - vendored.six = six - sys.modules['botocore'].vendored = vendored - sys.modules['botocore.vendored'] = vendored - sys.modules['botocore.vendored.six'] = six - sys.modules['botocore.vendored.six.moves'] = six.moves - import os from django.utils.translation import gettext_lazy as _ diff --git a/install/install.py b/install/install.py index 4adf12372..aff3b4f27 100644 --- a/install/install.py +++ b/install/install.py @@ -720,15 +720,18 @@ password="%s" os.chdir("/usr/local/CyberCP") - # Clear Python cache to avoid botocore vendored six import errors + # Clear Python cache to avoid import errors command = "find /usr/local/CyberCP -name '*.pyc' -delete" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) command = "find /usr/local/CyberCP -name '__pycache__' -type d -exec rm -rf {} +" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - # Ensure six module is installed to fix botocore compatibility - command = "/usr/local/CyberPanel/bin/python -m pip install six==1.16.0" + # Uninstall any old versions of boto3/botocore and reinstall clean versions + command = "/usr/local/CyberPanel/bin/python -m pip uninstall -y boto3 botocore" + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + + command = "/usr/local/CyberPanel/bin/python -m pip install --no-cache-dir boto3==1.34.153 botocore==1.34.153" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) command = "/usr/local/CyberPanel/bin/python manage.py makemigrations" diff --git a/plogical/acl.py b/plogical/acl.py index a9788791b..fda628581 100644 --- a/plogical/acl.py +++ b/plogical/acl.py @@ -1086,10 +1086,10 @@ class ACLManager: if ProcessUtilities.decideServer() == ProcessUtilities.OLS: #command = f"sed -i 's/docRoot\s\s*.*/docRoot {NewDocRoot}/g " + vhostConf - command = f"sed -i 's#docRoot\s\s*.*#docRoot {NewDocRoot}#g' " + vhostConf + command = f"sed -i 's#docRoot\\s\\s*.*#docRoot {NewDocRoot}#g' " + vhostConf ProcessUtilities.executioner(command, 'root', True) else: - command = f"sed -i 's#DocumentRoot\s\s*[^[:space:]]*#DocumentRoot {NewDocRoot}#g' " + vhostConf + command = f"sed -i 's#DocumentRoot\\s\\s*[^[:space:]]*#DocumentRoot {NewDocRoot}#g' " + vhostConf ProcessUtilities.executioner(command, 'root', True) except: @@ -1120,7 +1120,7 @@ class ACLManager: finalConfPath = ApacheVhost.configBasePath + domainName + '.conf' if ProcessUtilities.decideServer() == ProcessUtilities.OLS: - command = f"sed -i 's#DocumentRoot\s\s*[^[:space:]]*#DocumentRoot {NewDocRoot}#g' " + finalConfPath + command = f"sed -i 's#DocumentRoot\\s\\s*[^[:space:]]*#DocumentRoot {NewDocRoot}#g' " + finalConfPath ProcessUtilities.executioner(command, 'root', True) except: pass @@ -1152,7 +1152,7 @@ class ACLManager: $_ENV['snappymail_INCLUDE_AS_API'] = true; include '/usr/local/CyberCP/public/snappymail/index.php'; -$oConfig = \snappymail\Api::Config(); +$oConfig = \\snappymail\\Api::Config(); $oConfig->SetPassword('%s'); echo $oConfig->Save() ? 'Done' : 'Error'; @@ -1177,10 +1177,10 @@ echo $oConfig->Save() ? 'Done' : 'Error'; ###### fix Core CyberPanel permissions - command = "find /usr/local/CyberCP -type d -exec chmod 0755 {} \;" + command = "find /usr/local/CyberCP -type d -exec chmod 0755 {} \\;" ProcessUtilities.executioner(command, 'root', True) - command = "find /usr/local/CyberCP -type f -exec chmod 0644 {} \;" + command = "find /usr/local/CyberCP -type f -exec chmod 0644 {} \\;" ProcessUtilities.executioner(command, 'root', True) command = "chmod -R 755 /usr/local/CyberCP/bin" @@ -1193,10 +1193,10 @@ echo $oConfig->Save() ? 'Done' : 'Error'; ########### Fix LSCPD - command = "find /usr/local/lscp -type d -exec chmod 0755 {} \;" + command = "find /usr/local/lscp -type d -exec chmod 0755 {} \\;" ProcessUtilities.executioner(command, 'root', True) - command = "find /usr/local/lscp -type f -exec chmod 0644 {} \;" + command = "find /usr/local/lscp -type f -exec chmod 0644 {} \\;" ProcessUtilities.executioner(command, 'root', True) command = "chmod -R 755 /usr/local/lscp/bin" diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 055c1119c..ffe7027e1 100644 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -2260,10 +2260,10 @@ class MailServerManagerUtils(multi.Thread): def fixCyberPanelPermissions(self): ###### fix Core CyberPanel permissions - command = "find /usr/local/CyberCP -type d -exec chmod 0755 {} \;" + command = "find /usr/local/CyberCP -type d -exec chmod 0755 {} \\;" ProcessUtilities.executioner(command) - command = "find /usr/local/CyberCP -type f -exec chmod 0644 {} \;" + command = "find /usr/local/CyberCP -type f -exec chmod 0644 {} \\;" ProcessUtilities.executioner(command) command = "chmod -R 755 /usr/local/CyberCP/bin" @@ -2276,10 +2276,10 @@ class MailServerManagerUtils(multi.Thread): ########### Fix LSCPD - command = "find /usr/local/lscp -type d -exec chmod 0755 {} \;" + command = "find /usr/local/lscp -type d -exec chmod 0755 {} \\;" ProcessUtilities.executioner(command) - command = "find /usr/local/lscp -type f -exec chmod 0644 {} \;" + command = "find /usr/local/lscp -type f -exec chmod 0644 {} \\;" ProcessUtilities.executioner(command) command = "chmod -R 755 /usr/local/lscp/bin" diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index 9d5cf87fb..939e14d8f 100644 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -950,7 +950,7 @@ password=%s connection, cursor = mysqlUtilities.setupConnection() cursor.execute("use mysql") database = Databases.objects.get(dbName=databaseName) - databaseName = databaseName.replace('_', '\_') + databaseName = databaseName.replace('_', '\\_') query = "select user from db where db = '%s'" % (databaseName) if connection == 0: diff --git a/plogical/vhostConfs.py b/plogical/vhostConfs.py index d012e6bb1..b7c59fd1d 100644 --- a/plogical/vhostConfs.py +++ b/plogical/vhostConfs.py @@ -224,7 +224,7 @@ context /.well-known/acme-challenge { ProxySet disablereuse=off - + SetHandler proxy:fcgi://php-fpm-{externalApp} #CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined @@ -249,7 +249,7 @@ context /.well-known/acme-challenge { ProxySet disablereuse=off - + SetHandler proxy:fcgi://php-fpm-{externalApp} #CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined @@ -279,7 +279,7 @@ context /.well-known/acme-challenge { ProxySet disablereuse=off - + SetHandler proxy:fcgi://php-fpm-{externalApp} #CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined @@ -304,7 +304,7 @@ context /.well-known/acme-challenge { ProxySet disablereuse=off - + SetHandler proxy:fcgi://php-fpm-{externalApp} #CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined diff --git a/requirments.txt b/requirments.txt index 352f26891..18ab241e5 100644 --- a/requirments.txt +++ b/requirments.txt @@ -6,7 +6,6 @@ cloudflare==2.20.0 cryptography==43.0.0 cffi Django==4.2.14 -six==1.16.0 docker==7.1.0 google-api-core==2.19.1 google-api-python-client==2.139.0 diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 0d3d0605c..112236453 100644 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -4851,13 +4851,13 @@ StrictHostKeyChecking no if pages <= 1.0: pages = 1 - pagination.append('
  • ') + pagination.append('
  • ') else: pages = ceil(pages) finalPages = int(pages) + 1 for i in range(1, finalPages): - pagination.append('
  • ' + str(i) + '
  • ') + pagination.append('
  • ' + str(i) + '
  • ') return pagination @@ -4869,13 +4869,13 @@ StrictHostKeyChecking no if pages <= 1.0: pages = 1 - pagination.append('
  • ') + pagination.append('
  • ') else: pages = ceil(pages) finalPages = int(pages) + 1 for i in range(1, finalPages): - pagination.append('
  • ' + str(i) + '
  • ') + pagination.append('
  • ' + str(i) + '
  • ') return pagination