From ae84cd47278ba60ac03ea12f652bb7d73f88cef9 Mon Sep 17 00:00:00 2001 From: WhatTheServer Date: Sat, 22 Aug 2020 11:17:42 -0400 Subject: [PATCH] Update to add Magento 2.4 installation process Update to add Magento 2.4 installation process with elasticsearch factored in. Some things i recommend are to detect the current user's language and timezone and use that to set the language, timezone variables. These variables might also be helpful for other installations in the application manager and warrant adding dropdown menu for these on the application installer page for apps that support setting these during installation. Imagine if your primary language is chinese/Japanese and defaults to English if hardcoded or unset during installation navigating to those settings upon first login is going to be a pain. We should ideally detect the current language and use that as default or allow user selectable option which defaults to the current language and timezone of their cyberpanel user profile. Other things I recommend. adding check if ElasticSearch is already installed and if not firing off the ElasticSearch install script which is fired off by the button in the Application manager as its a requirement for Magento 2.4 --- plogical/applicationInstaller.py | 36 ++++++++++---------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 39f226b04..e8d3081a2 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -905,24 +905,14 @@ class ApplicationInstaller(multi.Thread): #### statusFile = open(tempStatusPath, 'w') - statusFile.writelines('Downloading and extracting Magento Core..,30') + statusFile.writelines('Downloading Magento Community Core via composer to document root ..,30') statusFile.close() - if sampleData: - command = "wget http://cyberpanelsh.b-cdn.net/latest-sample.tar.gz -P %s" % (finalPath) - else: - command = "wget http://cyberpanelsh.b-cdn.net/latest.tar.gz -P %s" % (finalPath) + command = 'composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition %s' % (finalPath) ProcessUtilities.executioner(command, externalApp) - if sampleData: - command = 'tar -xf %slatest-sample.tar.gz --directory %s' % (finalPath, finalPath) - else: - command = 'tar -xf %slatest.tar.gz --directory %s' % (finalPath, finalPath) - - ProcessUtilities.executioner(command, externalApp) - - ## + ### statusFile = open(tempStatusPath, 'w') statusFile.writelines('Configuring the installation,40') @@ -939,21 +929,17 @@ class ApplicationInstaller(multi.Thread): statusFile.writelines('Installing and configuring Magento..,60') statusFile.close() - command = '/usr/local/lsws/lsphp72/bin/php -d memory_limit=512M %sbin/magento setup:install --backend-frontname="admin" ' \ - '--db-host="localhost" --db-name="%s" --db-user="%s" --db-password="%s" ' \ - '--base-url="http://%s" --base-url-secure="https://%s/" --admin-user="%s" ' \ - '--admin-password="%s" --admin-email="%s" --admin-firstname="%s" --admin-lastname="%s"' \ - % (finalPath, dbName, dbUser, dbPassword, finalURL, finalURL, username, password, email, firstName, lastName) - result = ProcessUtilities.outputExecutioner(command, externalApp) - logging.writeToFile(result) + command = '/usr/local/lsws/lsphp73/bin/php -d memory_limit=512M %sbin/magento setup:install --base-url="http://%s" ' \ + ' --db-host="localhost" --db-name="%s" --db-user="%s" --db-password="%s" --admin-firstname="%s" ' \ + ' --admin-lastname="%s" --admin-email="%s" --admin-user="%s" --admin-password="%s" --language="%s" --timezone="%s" ' \ + ' --use-rewrites=1 --search-engine="elasticsearch7" --elasticsearch-host="localhost" --elasticsearch-port="9200" ' \ + ' --elasticsearch-index-prefix="%s"' \ + % (finalPath, finalURL, dbName, dbUser, dbPassword, firstName, lastName, email, username, password, language, timezone, dbName ) + result = ProcessUtilities.outputExecutioner(command, externalApp) + logging.writeToFile(result) ## - if sampleData: - command = 'rm -rf %slatest-sample.tar.gz' % (finalPath) - else: - command = 'rm -rf %slatest.tar.gz' % (finalPath) - ProcessUtilities.executioner(command, externalApp) ##