add support for ubuntu 24

This commit is contained in:
usmannasir 2025-06-28 18:56:48 +05:00
parent cb31db90f7
commit f69840d0b9
8 changed files with 27 additions and 44 deletions

View File

@ -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 _

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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:

View File

@ -224,7 +224,7 @@ context /.well-known/acme-challenge {
<Proxy "unix:{sockPath}{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
ProxySet disablereuse=off
</proxy>
<FilesMatch \.php$>
<FilesMatch \\.php$>
SetHandler proxy:fcgi://php-fpm-{externalApp}
</FilesMatch>
#CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined
@ -249,7 +249,7 @@ context /.well-known/acme-challenge {
<Proxy "unix:{sockPath}{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
ProxySet disablereuse=off
</proxy>
<FilesMatch \.php$>
<FilesMatch \\.php$>
SetHandler proxy:fcgi://php-fpm-{externalApp}
</FilesMatch>
#CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined
@ -279,7 +279,7 @@ context /.well-known/acme-challenge {
<Proxy "unix:{sockPath}{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
ProxySet disablereuse=off
</proxy>
<FilesMatch \.php$>
<FilesMatch \\.php$>
SetHandler proxy:fcgi://php-fpm-{externalApp}
</FilesMatch>
#CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined
@ -304,7 +304,7 @@ context /.well-known/acme-challenge {
<Proxy "unix:{sockPath}{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
ProxySet disablereuse=off
</proxy>
<FilesMatch \.php$>
<FilesMatch \\.php$>
SetHandler proxy:fcgi://php-fpm-{externalApp}
</FilesMatch>
#CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined

View File

@ -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

View File

@ -4851,13 +4851,13 @@ StrictHostKeyChecking no
if pages <= 1.0:
pages = 1
pagination.append('<li><a href="\#"></a></li>')
pagination.append('<li><a href="\\#"></a></li>')
else:
pages = ceil(pages)
finalPages = int(pages) + 1
for i in range(1, finalPages):
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
pagination.append('<li><a href="\\#">' + str(i) + '</a></li>')
return pagination
@ -4869,13 +4869,13 @@ StrictHostKeyChecking no
if pages <= 1.0:
pages = 1
pagination.append('<li><a href="\#"></a></li>')
pagination.append('<li><a href="\\#"></a></li>')
else:
pages = ceil(pages)
finalPages = int(pages) + 1
for i in range(1, finalPages):
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
pagination.append('<li><a href="\\#">' + str(i) + '</a></li>')
return pagination