From c417aa1be113a0e797f81560d6bb70e393537f9e Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 14 Jan 2021 14:19:34 +0100 Subject: [PATCH] Fix installing rdkafka in PHP 5.6 See https://mlocati.github.io/pecl-info/#rdkafka Test: rdkafka --- install-php-extensions | 45 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index aab1e93..bab5302 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -2,7 +2,7 @@ # This script wraps docker-php-ext-install, properly configuring the system. # -# Copyright (c) Michele Locati, 2018-2020 +# Copyright (c) Michele Locati, 2018-2021 # # Source: https://github.com/mlocati/docker-php-extension-installer # @@ -1643,27 +1643,34 @@ installRemoteModule() { ;; rdkafka) if test -z "$installRemoteModule_version"; then + installRemoteModule_version1='' if test $PHP_MAJMIN_VERSION -le 505; then - installRemoteModule_version=3.0.5 - else - installRemoteModule_tmp= - case "$DISTRO" in - alpine) - installRemoteModule_tmp='librdkafka' - ;; - debian) - installRemoteModule_tmp='librdkafka*' - ;; - esac - if test -n "$installRemoteModule_tmp"; then - installRemoteModule_tmp="$(getInstalledPackageVersion "$installRemoteModule_tmp")" - if test -n "$installRemoteModule_tmp"; then - if test $(compareVersions "$installRemoteModule_tmp" '0.11.0') -lt 0; then - installRemoteModule_version=3.1.3 - fi - fi + installRemoteModule_version1=3.0.5 + elif test $PHP_MAJMIN_VERSION -le 506; then + installRemoteModule_version1=4.1.2 + fi + installRemoteModule_version2='' + case "$DISTRO" in + alpine) + installRemoteModule_tmp='librdkafka' + ;; + debian) + installRemoteModule_tmp='librdkafka*' + ;; + esac + if test -n "$installRemoteModule_tmp"; then + installRemoteModule_tmp="$(getInstalledPackageVersion "$installRemoteModule_tmp")" + if test -n "$installRemoteModule_tmp" && test $(compareVersions "$installRemoteModule_tmp" '0.11.0') -lt 0; then + installRemoteModule_version2=3.1.3 fi fi + if test -z "$installRemoteModule_version1" || test -z "$installRemoteModule_version2"; then + installRemoteModule_version="$installRemoteModule_version1$installRemoteModule_version2" + elif test $(compareVersions "$installRemoteModule_version1" "$installRemoteModule_version2") -le 0; then + installRemoteModule_version="$installRemoteModule_version1" + else + installRemoteModule_version="$installRemoteModule_version2" + fi fi ;; redis)