From bcee5c3da2bfef49d247242ad057d65d2b623ae7 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Thu, 10 Aug 2023 12:26:06 +0500 Subject: [PATCH] bug fix: upgrade mautic version and fix installation issues --- plogical/applicationInstaller.py | 13 ++++++++++-- plogical/phpUtilities.py | 20 ++++++++++++++++++- .../websiteFunctions/installMautic.html | 4 +++- websiteFunctions/website.py | 9 +++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 408f47519..017f86757 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -31,7 +31,7 @@ class ApplicationInstaller(multi.Thread): LOCALHOST = 'localhost' REMOTE = 0 PORT = '3306' - MauticVersion = '4.4.0' + MauticVersion = '4.4.9' PrestaVersion = '1.7.8.3' def __init__(self, installApp, extraArgs): @@ -99,6 +99,15 @@ class ApplicationInstaller(multi.Thread): password = self.extraArgs['password'] email = self.extraArgs['email'] + + ### lets first find php path + + from plogical.phpUtilities import phpUtilities + + vhFile = f'/usr/local/lsws/conf/vhosts/{domainName}/vhost.conf' + + phpPath = phpUtilities.GetPHPVersionFromFile(vhFile) + FNULL = open(os.devnull, 'w') ## Open Status File @@ -242,7 +251,7 @@ $parameters = array( command = 'cp %s %s/app/config/local.php' % (localDB, finalPath) ProcessUtilities.executioner(command, externalApp) - command = "/usr/local/lsws/lsphp80/bin/php bin/console mautic:install http://%s -f" % (finalURL) + command = f"{phpPath} bin/console mautic:install http://%s -f" % (finalURL) result = ProcessUtilities.outputExecutioner(command, externalApp, None, finalPath) if result.find('Install complete') == -1: diff --git a/plogical/phpUtilities.py b/plogical/phpUtilities.py index ff567bc56..c663e46e4 100755 --- a/plogical/phpUtilities.py +++ b/plogical/phpUtilities.py @@ -191,7 +191,6 @@ class phpUtilities: str(msg) + " [savePHPConfigAdvance]") print("0,"+str(msg)) - @staticmethod def GetStagingInJson(stagings): try: @@ -217,6 +216,25 @@ class phpUtilities: except BaseException as msg: return msg + @staticmethod + def GetPHPVersionFromFile(vhFile): + if ProcessUtilities.decideServer() == ProcessUtilities.OLS: + command = f'grep -Eo "/usr/local/lsws/lsphp[0-9]+/bin/lsphp" {vhFile}' + result = ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n') + + result = result.rsplit("lsphp", 1)[0] + "php" + return result + + else: + command = f'grep -Eo -m 1 "php[0-9]+" {vhFile}' + result = ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n') + result = f'/usr/local/lsws/ls{result}/bin/lsphp' + result = result.rsplit("lsphp", 1)[0] + "php" + return result + + + + def main(): diff --git a/websiteFunctions/templates/websiteFunctions/installMautic.html b/websiteFunctions/templates/websiteFunctions/installMautic.html index dbda62697..b3388b446 100755 --- a/websiteFunctions/templates/websiteFunctions/installMautic.html +++ b/websiteFunctions/templates/websiteFunctions/installMautic.html @@ -21,8 +21,10 @@
+ {% trans "Before installing Mautic, we will change the PHP version of the website to PHP 8.0, which is supported by Mautic." %} -
+ +
diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index d3eb0a9c7..69f197b45 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -4252,6 +4252,15 @@ StrictHostKeyChecking no else: return ACLManager.loadErrorJson('installStatus', 0) + + #### Before installing mautic change php to 8.0 + + completePathToConfigFile = f'/usr/local/lsws/conf/vhosts/{self.domain}/vhost.conf' + + execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = execPath + " changePHP --phpVersion 'PHP 8.0' --path " + completePathToConfigFile + ProcessUtilities.executioner(execPath) + mailUtilities.checkHome() extraArgs = {}