Skip to content

Commit fd8b3e8

Browse files
author
fratcliffe
committed
Auto detect Magento version in order to delete config template only if >=2.2
1 parent ece3a24 commit fd8b3e8

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

magento2/usr/local/share/env/30-framework

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,7 @@ export MAGENTO_ENABLE_CONFIG_WEBSERVICE_CACHE
169169
MAGENTO_ENABLE_TARGET_RULE_CACHE=$(convert_to_boolean_string "${MAGENTO_ENABLE_TARGET_RULE_CACHE:-true}")
170170
export MAGENTO_ENABLE_TARGET_RULE_CACHE
171171

172-
function detect_enterprise_edition() (
173-
set +e
174-
source /usr/local/share/php/common_functions.sh
175-
if has_composer_package "magento/product-enterprise-edition"; then
176-
echo 'true'
177-
else
178-
echo 'false'
179-
fi
180-
)
181-
MAGENTO_ENTERPRISE_EDITION=$(convert_to_boolean_string "${MAGENTO_ENTERPRISE_EDITION:-$(detect_enterprise_edition)}")
172+
MAGENTO_ENTERPRISE_EDITION=$(convert_to_boolean_string "${MAGENTO_ENTERPRISE_EDITION:-$(run_return_boolean has_composer_package "magento/product-enterprise-edition")}")
182173
export MAGENTO_ENTERPRISE_EDITION
183174

184-
export MAGENTO_VERSION="${MAGENTO_VERSION:-2.1}"
175+
export MAGENTO_VERSION="${MAGENTO_VERSION:-$(composer_package_version magento/product-community-edition | cut -d. -f1,2)}"

magento2/usr/local/share/magento2/magento_functions.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,15 @@ function do_magento_download_magerun2() {
408408
chmod +x /app/bin/n98-magerun2.phar
409409
}
410410

411-
function do_magento2_templating() {
412-
if [ "$MAGENTO_VERSION" != "2.0" ] && [ "$MAGENTO_VERSION" != "2.1" ]; then
411+
function remove_config_template() (
412+
set +e
413+
if dpkg --compare-versions "$MAGENTO_VERSION" ge 2.2; then
413414
rm -f /etc/confd/conf.d/magento_config.php.toml /etc/confd/templates/magento/config.php.tmpl
414415
fi
416+
)
417+
418+
function do_magento2_templating() {
419+
remove_config_template
415420

416421
mkdir -p /app/app/etc/
417422
chown -R "${CODE_OWNER}:${CODE_GROUP}" /app/app/

0 commit comments

Comments
 (0)