From 36e33e130a49b071a20544f79d65b977e8eb94bf Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Mon, 3 Apr 2023 02:48:41 +0530 Subject: [PATCH] Add known non-default extension priorities in a config --- src/configs/mod_priority | 27 ++++++++++++++++++++++++ src/scripts/extensions/add_extensions.sh | 7 +++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/configs/mod_priority diff --git a/src/configs/mod_priority b/src/configs/mod_priority new file mode 100644 index 000000000..7ef31062d --- /dev/null +++ b/src/configs/mod_priority @@ -0,0 +1,27 @@ +apc=25 +apcu_bc=25 +apcu-bc=25 +blackfire=30 +decimal=30 +ds=30 +grpc=30 +http=25 +pecl_http=25 +pecl-http=25 +inotify=30 +libvirt-php=40 +mailparse=25 +maxminddb=30 +memcached=25 +mysqlnd=10 +mysqlnd_ms=30 +opcache=10 +pdo=10 +phalcon=35 +protobuf=30 +psr=15 +rdkafka=30 +swoole=25 +vips=30 +xml=15 +zstd=30 diff --git a/src/scripts/extensions/add_extensions.sh b/src/scripts/extensions/add_extensions.sh index 2d84e18ad..06357bb36 100644 --- a/src/scripts/extensions/add_extensions.sh +++ b/src/scripts/extensions/add_extensions.sh @@ -50,7 +50,12 @@ enable_extension() { enable_cache_extension_dependencies "$1" "$2" if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod >/dev/null 2>&1; then mod="${ini_dir:?}"/../mods-available/"$1".ini - [ -e "$mod" ] || (echo "; priority=${3:'20'}"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null + if ! [ -e "$mod" ]; then + priority="${3:-20}"; + mod_priority_line="$(grep -E "^$1=" "${src:?}/configs/mod_priority")"; + [ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2) + (echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null + fi sudo phpenmod -v "$version" "$1" >/dev/null 2>&1 else echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null