From 17a9f81ab7633cc6f01633288e75814affd03ab7 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 27 Mar 2024 16:16:14 +0400 Subject: [PATCH] bug fix: update prestashop version and fix with prestashop installation: https://community.cyberpanel.net/t/prestashop-kicks-out-from-admin-panel/52905 --- plogical/applicationInstaller.py | 31 ++++++++++++++++++++++++++----- websiteFunctions/website.py | 6 ++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index f4e2c9806..0288fa3d7 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -1003,6 +1003,22 @@ class ApplicationInstaller(multi.Thread): dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website) self.permPath = '/home/%s/public_html' % (website.domain) + ### lets first find php path + + from plogical.phpUtilities import phpUtilities + + vhFile = f'/usr/local/lsws/conf/vhosts/{domainName}/vhost.conf' + + phpPath = phpUtilities.GetPHPVersionFromFile(vhFile, domainName) + + ### basically for now php 8.1 is being checked + + if not os.path.exists(phpPath): + statusFile = open(tempStatusPath, 'w') + statusFile.writelines('PHP 8.1 missing installing now..,20') + statusFile.close() + phpUtilities.InstallSaidPHP('81') + ## Security Check # command = 'chmod 755 %s' % (self.permPath) @@ -1026,9 +1042,10 @@ class ApplicationInstaller(multi.Thread): statusFile.writelines('Downloading and extracting PrestaShop Core..,30') statusFile.close() - command = "wget https://download.prestashop.com/download/releases/prestashop_%s.zip -P %s" % ( - ApplicationInstaller.PrestaVersion, - finalPath) + # command = "wget https://download.prestashop.com/download/releases/prestashop_%s.zip -P %s" % ( + # ApplicationInstaller.PrestaVersion, + # finalPath) + command = f"wget https://github.com/PrestaShop/PrestaShop/releases/download/{ApplicationInstaller.PrestaVersion}/prestashop_{ApplicationInstaller.PrestaVersion}.zip -P {finalPath}" ProcessUtilities.executioner(command, externalApp) command = "unzip -o %sprestashop_%s.zip -d " % (finalPath, ApplicationInstaller.PrestaVersion) + finalPath @@ -1037,6 +1054,7 @@ class ApplicationInstaller(multi.Thread): command = "unzip -o %sprestashop.zip -d " % (finalPath) + finalPath ProcessUtilities.executioner(command, externalApp) + ## statusFile = open(tempStatusPath, 'w') @@ -1054,11 +1072,14 @@ class ApplicationInstaller(multi.Thread): statusFile.writelines('Installing and configuring PrestaShop..,60') statusFile.close() - command = "php " + finalPath + "install/index_cli.php --domain=" + finalURL + \ + command = f"{phpPath} " + finalPath + "install/index_cli.php --domain=" + finalURL + \ " --db_server=localhost --db_name=" + dbName + " --db_user=" + dbUser + " --db_password=" + dbPassword \ + " --name='" + shopName + "' --firstname=" + firstName + " --lastname=" + lastName + \ " --email=" + email + " --password=" + password - ProcessUtilities.executioner(command, externalApp) + resut = ProcessUtilities.outputExecutioner(command, externalApp) + + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(resut) ## diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 486a5dda3..8ae52aa8b 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -4514,6 +4514,12 @@ StrictHostKeyChecking no if data['home'] == '0': extraArgs['path'] = data['path'] + 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.1' --path " + completePathToConfigFile + ProcessUtilities.executioner(execPath) + background = ApplicationInstaller('prestashop', extraArgs) background.start()