Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle PDO driver extensions #253

Open
wants to merge 2 commits into
base: 1.41.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions scripts/extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,22 @@ declare -a EXTENSIONS=(${@:2})
ENABLED_EXTENSIONS=$(php -m | tr '[:upper:]' '[:lower:]' | egrep -v '^[\[]' | grep -v 'zend opcache')
EXTENSIONS_TO_INSTALL=()

add_extension_to_install() {
local EXTENSION=$1

# Prevent duplicates
for TO_BE_INSTALLED in "${EXTENSIONS_TO_INSTALL[@]}"; do
if [[ "${TO_BE_INSTALLED}" == "${EXTENSION}" ]]; then
return
fi
done

EXTENSIONS_TO_INSTALL+=("${EXTENSION}")
}

# Loop through known statically compiled/installed extensions, and enable them.
# NOTE: when developing on MacOS, remove the quotes while implementing your changes and re-add the quotes afterwards.
for EXTENSION in "${EXTENSIONS[@]}"; do

# Check if extension is already enabled
REGULAR_EXPRESSION=\\b${EXTENSION}\\b
if [[ "${ENABLED_EXTENSIONS}" =~ $REGULAR_EXPRESSION ]]; then
Expand All @@ -112,7 +124,32 @@ for EXTENSION in "${EXTENSIONS[@]}"; do
continue;
fi

EXTENSIONS_TO_INSTALL+=("$EXTENSION")
if [[ "${EXTENSION}" =~ ^pdo_ ]]; then
case "${EXTENSION}" in
"pdo_mysql")
add_extension_to_install "mysql"
;;
"pdo_sqlite")
add_extension_to_install "sqlite3"
;;
"pdo_pgsql")
add_extension_to_install "pgsql"
;;
*)
echo "Unsupported PDO driver extension \"${EXTENSION}\" cannot is not (yet) supported."
echo -n "In case the extension is not available already, please consider using .pre-install.sh to install"
echo " the appropriate extension."
echo -n "If you think its worth to have the PDO driver extension installed automatically, please create"
echo " a feature request on github: https://github.com/laminas/laminas-continuous-integration-action/issues"
continue;
;;
esac

add_extension_to_install "pdo"
continue;
fi

add_extension_to_install "${EXTENSION}"
done

# If by now the extensions list is not empty, install missing extensions.
Expand Down