Skip to content

Commit ff2b3dd

Browse files
authored
Merge pull request #253 from boesing/feature/pdo-extension-driver
Handle PDO driver extensions
2 parents 9bd1c14 + 329c927 commit ff2b3dd

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

scripts/extensions.sh

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,22 @@ declare -a EXTENSIONS=(${@:2})
9393
ENABLED_EXTENSIONS=$(php -m | tr '[:upper:]' '[:lower:]' | egrep -v '^[\[]' | grep -v 'zend opcache')
9494
EXTENSIONS_TO_INSTALL=()
9595

96+
add_extension_to_install() {
97+
local EXTENSION=$1
98+
99+
# Prevent duplicates
100+
for TO_BE_INSTALLED in "${EXTENSIONS_TO_INSTALL[@]}"; do
101+
if [[ "${TO_BE_INSTALLED}" == "${EXTENSION}" ]]; then
102+
return
103+
fi
104+
done
105+
106+
EXTENSIONS_TO_INSTALL+=("${EXTENSION}")
107+
}
108+
96109
# Loop through known statically compiled/installed extensions, and enable them.
97110
# NOTE: when developing on MacOS, remove the quotes while implementing your changes and re-add the quotes afterwards.
98111
for EXTENSION in "${EXTENSIONS[@]}"; do
99-
100112
# Check if extension is already enabled
101113
REGULAR_EXPRESSION=\\b${EXTENSION}\\b
102114
if [[ "${ENABLED_EXTENSIONS}" =~ $REGULAR_EXPRESSION ]]; then
@@ -112,7 +124,32 @@ for EXTENSION in "${EXTENSIONS[@]}"; do
112124
continue;
113125
fi
114126

115-
EXTENSIONS_TO_INSTALL+=("$EXTENSION")
127+
if [[ "${EXTENSION}" =~ ^pdo_ ]]; then
128+
case "${EXTENSION}" in
129+
"pdo_mysql")
130+
add_extension_to_install "mysql"
131+
;;
132+
"pdo_sqlite")
133+
add_extension_to_install "sqlite3"
134+
;;
135+
"pdo_pgsql")
136+
add_extension_to_install "pgsql"
137+
;;
138+
*)
139+
echo "Unsupported PDO driver extension \"${EXTENSION}\" cannot is not (yet) supported."
140+
echo -n "In case the extension is not available already, please consider using .pre-install.sh to install"
141+
echo " the appropriate extension."
142+
echo -n "If you think its worth to have the PDO driver extension installed automatically, please create"
143+
echo " a feature request on github: https://github.com/laminas/laminas-continuous-integration-action/issues"
144+
continue;
145+
;;
146+
esac
147+
148+
add_extension_to_install "pdo"
149+
continue;
150+
fi
151+
152+
add_extension_to_install "${EXTENSION}"
116153
done
117154

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

0 commit comments

Comments
 (0)