From 9ad40d5f2f3a6318b8a5cc0740b6a2b683968e56 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 4 Oct 2024 15:49:14 +0500 Subject: [PATCH] bug fix: mautic installer on ubuntu 22 --- plogical/applicationInstaller.py | 72 +++++++++++-------- .../websiteFunctions/installMautic.html | 2 +- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 572d72dfc..bcef61d53 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -123,45 +123,38 @@ def InstallNodeJS(self): if result.find('npm ') > -1: return 1 - if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: - nodeV = ProcessUtilities.fetch_latest_lts_version_for_node() + nodeV = ProcessUtilities.fetch_latest_lts_version_for_node() - if ACLManager.ISARM(): - command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-arm64.tar.xz' - ProcessUtilities.executioner(command, 'root', True) - - command = f'tar -xf node-{nodeV}-linux-arm64.tar.xz ' - ProcessUtilities.executioner(command, 'root', True) + if ACLManager.ISARM(): + command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-arm64.tar.xz' + ProcessUtilities.executioner(command, 'root', True) - command = f'cp node-{nodeV}-linux-arm64/bin/node /usr/bin/node' - ProcessUtilities.executioner(command, 'root', True) + command = f'tar -xf node-{nodeV}-linux-arm64.tar.xz ' + ProcessUtilities.executioner(command, 'root', True) - command = 'curl -qL https://www.npmjs.com/install.sh | sh' - ProcessUtilities.executioner(command, 'root', True) + command = f'cp node-{nodeV}-linux-arm64/bin/node /usr/bin/node' + ProcessUtilities.executioner(command, 'root', True) - command = f'rm -rf node-{nodeV}-linux-arm64*' - ProcessUtilities.executioner(command, 'root', True) - else: + command = 'curl -qL https://www.npmjs.com/install.sh | sh' + ProcessUtilities.executioner(command, 'root', True) - command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-x64.tar.xz' - ProcessUtilities.executioner(command, 'root', True) + command = f'rm -rf node-{nodeV}-linux-arm64*' + ProcessUtilities.executioner(command, 'root', True) + else: - command = f'tar -xf node-{nodeV}-linux-x64.tar.xz' - ProcessUtilities.executioner(command, 'root', True) + command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-x64.tar.xz' + ProcessUtilities.executioner(command, 'root', True) - command = f'cp node-{nodeV}-linux-x64/bin/node /usr/bin/node' - ProcessUtilities.executioner(command, 'root', True) + command = f'tar -xf node-{nodeV}-linux-x64.tar.xz' + ProcessUtilities.executioner(command, 'root', True) - command = 'curl -qL https://www.npmjs.com/install.sh | sh' - ProcessUtilities.executioner(command, 'root', True) + command = f'cp node-{nodeV}-linux-x64/bin/node /usr/bin/node' + ProcessUtilities.executioner(command, 'root', True) - command = f'rm -rf node-{nodeV}-linux-x64*' - ProcessUtilities.executioner(command, 'root', True) - else: - #command = 'curl -fsSL | sudo -E bash -' - #ProcessUtilities.executioner(command, 'root', True) + command = 'curl -qL https://www.npmjs.com/install.sh | sh' + ProcessUtilities.executioner(command, 'root', True) - command = 'DEBIAN_FRONTEND=noninteractive apt-get install nodejs npm -y' + command = f'rm -rf node-{nodeV}-linux-x64*' ProcessUtilities.executioner(command, 'root', True) return 1 @@ -198,7 +191,7 @@ def installMautic(self): phpPath = phpUtilities.GetPHPVersionFromFile(vhFile, domainName) - ### basically for now php 8.0 is being checked + ### basically for now php 8.1 is being checked if not os.path.exists(phpPath): statusFile = open(tempStatusPath, 'w') @@ -206,6 +199,18 @@ def installMautic(self): statusFile.close() phpUtilities.InstallSaidPHP('81') + ### if web is using apache then some missing extensions are required to install + + finalConfPath = ApacheVhost.configBasePath + domainName + '.conf' + if os.path.exists(finalConfPath): + + if ProcessUtilities.decideDistro() == ProcessUtilities.cent8 or ProcessUtilities.decideDistro() == ProcessUtilities.centos: + command = 'dnf install php7.?-bcmath php7.?-imap php8.?-bcmath php8.?-imap -y' + else: + command = 'DEBIAN_FRONTEND=noninteractive apt-get install php7.?-bcmath php7.?-imap php8.?-bcmath php8.?-imap -y' + + ProcessUtilities.executioner(command) + FNULL = open(os.devnull, 'w') @@ -362,10 +367,15 @@ def installMautic(self): #os.remove(localDB) command = f"systemctl restart {ApacheVhost.serviceName}" - ProcessUtilities.normalExecutioner(command) + ProcessUtilities.executioner(command) installUtilities.reStartLiteSpeedSocket() + time.sleep(3) + + command = f"systemctl restart {ApacheVhost.serviceName}" + ProcessUtilities.executioner(command) + statusFile = open(tempStatusPath, 'w') statusFile.writelines("Successfully Installed. [200]") statusFile.close() diff --git a/websiteFunctions/templates/websiteFunctions/installMautic.html b/websiteFunctions/templates/websiteFunctions/installMautic.html index b3388b446..015830dc7 100755 --- a/websiteFunctions/templates/websiteFunctions/installMautic.html +++ b/websiteFunctions/templates/websiteFunctions/installMautic.html @@ -21,7 +21,7 @@

- {% trans "Before installing Mautic, we will change the PHP version of the website to PHP 8.0, which is supported by Mautic." %} + {% trans "Before installing Mautic, we will change the PHP version of the website to PHP 8.1, which is supported by Mautic." %}