diff --git a/7.4/alpine3.14/cli/docker-php-ext-enable b/7.4/alpine3.14/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/alpine3.14/cli/docker-php-ext-enable +++ b/7.4/alpine3.14/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/alpine3.14/fpm/docker-php-ext-enable b/7.4/alpine3.14/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/alpine3.14/fpm/docker-php-ext-enable +++ b/7.4/alpine3.14/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/alpine3.14/zts/docker-php-ext-enable b/7.4/alpine3.14/zts/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/alpine3.14/zts/docker-php-ext-enable +++ b/7.4/alpine3.14/zts/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/alpine3.15/cli/docker-php-ext-enable b/7.4/alpine3.15/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/alpine3.15/cli/docker-php-ext-enable +++ b/7.4/alpine3.15/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/alpine3.15/fpm/docker-php-ext-enable b/7.4/alpine3.15/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/alpine3.15/fpm/docker-php-ext-enable +++ b/7.4/alpine3.15/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/alpine3.15/zts/docker-php-ext-enable b/7.4/alpine3.15/zts/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/alpine3.15/zts/docker-php-ext-enable +++ b/7.4/alpine3.15/zts/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/bullseye/apache/docker-php-ext-enable b/7.4/bullseye/apache/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/bullseye/apache/docker-php-ext-enable +++ b/7.4/bullseye/apache/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/bullseye/cli/docker-php-ext-enable b/7.4/bullseye/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/bullseye/cli/docker-php-ext-enable +++ b/7.4/bullseye/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/bullseye/fpm/docker-php-ext-enable b/7.4/bullseye/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/bullseye/fpm/docker-php-ext-enable +++ b/7.4/bullseye/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/bullseye/zts/docker-php-ext-enable b/7.4/bullseye/zts/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/bullseye/zts/docker-php-ext-enable +++ b/7.4/bullseye/zts/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/buster/apache/docker-php-ext-enable b/7.4/buster/apache/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/buster/apache/docker-php-ext-enable +++ b/7.4/buster/apache/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/buster/cli/docker-php-ext-enable b/7.4/buster/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/buster/cli/docker-php-ext-enable +++ b/7.4/buster/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/buster/fpm/docker-php-ext-enable b/7.4/buster/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/buster/fpm/docker-php-ext-enable +++ b/7.4/buster/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/7.4/buster/zts/docker-php-ext-enable b/7.4/buster/zts/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/7.4/buster/zts/docker-php-ext-enable +++ b/7.4/buster/zts/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/alpine3.14/cli/docker-php-ext-enable b/8.0/alpine3.14/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/alpine3.14/cli/docker-php-ext-enable +++ b/8.0/alpine3.14/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/alpine3.14/fpm/docker-php-ext-enable b/8.0/alpine3.14/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/alpine3.14/fpm/docker-php-ext-enable +++ b/8.0/alpine3.14/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/alpine3.15/cli/docker-php-ext-enable b/8.0/alpine3.15/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/alpine3.15/cli/docker-php-ext-enable +++ b/8.0/alpine3.15/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/alpine3.15/fpm/docker-php-ext-enable b/8.0/alpine3.15/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/alpine3.15/fpm/docker-php-ext-enable +++ b/8.0/alpine3.15/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/bullseye/apache/docker-php-ext-enable b/8.0/bullseye/apache/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/bullseye/apache/docker-php-ext-enable +++ b/8.0/bullseye/apache/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/bullseye/cli/docker-php-ext-enable b/8.0/bullseye/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/bullseye/cli/docker-php-ext-enable +++ b/8.0/bullseye/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/bullseye/fpm/docker-php-ext-enable b/8.0/bullseye/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/bullseye/fpm/docker-php-ext-enable +++ b/8.0/bullseye/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/bullseye/zts/docker-php-ext-enable b/8.0/bullseye/zts/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/bullseye/zts/docker-php-ext-enable +++ b/8.0/bullseye/zts/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/buster/apache/docker-php-ext-enable b/8.0/buster/apache/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/buster/apache/docker-php-ext-enable +++ b/8.0/buster/apache/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/buster/cli/docker-php-ext-enable b/8.0/buster/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/buster/cli/docker-php-ext-enable +++ b/8.0/buster/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/buster/fpm/docker-php-ext-enable b/8.0/buster/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/buster/fpm/docker-php-ext-enable +++ b/8.0/buster/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.0/buster/zts/docker-php-ext-enable b/8.0/buster/zts/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.0/buster/zts/docker-php-ext-enable +++ b/8.0/buster/zts/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/alpine3.14/cli/docker-php-ext-enable b/8.1/alpine3.14/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/alpine3.14/cli/docker-php-ext-enable +++ b/8.1/alpine3.14/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/alpine3.14/fpm/docker-php-ext-enable b/8.1/alpine3.14/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/alpine3.14/fpm/docker-php-ext-enable +++ b/8.1/alpine3.14/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/alpine3.15/cli/docker-php-ext-enable b/8.1/alpine3.15/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/alpine3.15/cli/docker-php-ext-enable +++ b/8.1/alpine3.15/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/alpine3.15/fpm/docker-php-ext-enable b/8.1/alpine3.15/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/alpine3.15/fpm/docker-php-ext-enable +++ b/8.1/alpine3.15/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/bullseye/apache/docker-php-ext-enable b/8.1/bullseye/apache/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/bullseye/apache/docker-php-ext-enable +++ b/8.1/bullseye/apache/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/bullseye/cli/docker-php-ext-enable b/8.1/bullseye/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/bullseye/cli/docker-php-ext-enable +++ b/8.1/bullseye/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/bullseye/fpm/docker-php-ext-enable b/8.1/bullseye/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/bullseye/fpm/docker-php-ext-enable +++ b/8.1/bullseye/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/bullseye/zts/docker-php-ext-enable b/8.1/bullseye/zts/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/bullseye/zts/docker-php-ext-enable +++ b/8.1/bullseye/zts/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/buster/apache/docker-php-ext-enable b/8.1/buster/apache/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/buster/apache/docker-php-ext-enable +++ b/8.1/buster/apache/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/buster/cli/docker-php-ext-enable b/8.1/buster/cli/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/buster/cli/docker-php-ext-enable +++ b/8.1/buster/cli/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/buster/fpm/docker-php-ext-enable b/8.1/buster/fpm/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/buster/fpm/docker-php-ext-enable +++ b/8.1/buster/fpm/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/8.1/buster/zts/docker-php-ext-enable b/8.1/buster/zts/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/8.1/buster/zts/docker-php-ext-enable +++ b/8.1/buster/zts/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done diff --git a/docker-php-ext-enable b/docker-php-ext-enable index 41d20bbe3f..b58b19519e 100755 --- a/docker-php-ext-enable +++ b/docker-php-ext-enable @@ -8,6 +8,7 @@ usage() { echo "usage: $0 [options] module-name [module-name ...]" echo " ie: $0 gd mysqli" echo " $0 pdo pdo_mysql" + echo " $0 --disable gd mysqli" echo " $0 --ini-name 0-apc.ini apcu apc" echo echo 'Possible values for module-name:' @@ -22,15 +23,17 @@ usage() { echo 'the output of "php -i" to see which modules are already loaded.' } -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +opts="$(getopt -o 'h?' --long 'help,disable,ini-name:' -- "$@" || { usage >&2 && false; })" eval set -- "$opts" +isDisable= iniName= while true; do flag="$1" shift case "$flag" in --help|-h|'-?') usage && exit 0 ;; + --disable) isDisable=1 ;; --ini-name) iniName="$1" && shift ;; --) break ;; *) @@ -111,8 +114,22 @@ for module in $modules; do ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" ;; esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" + if [ -z "$isDisable" ]; then + if [ -f "$ini-disabled" ]; then + mv "$ini-disabled" "$ini" + else + if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi + fi + else + if ! [ -f "$ini" ]; then + echo >&2 + echo >&2 "warning: $ext ($module) is not enabled!" + echo >&2 + continue + fi + mv "$ini" "$ini-disabled" fi done