Skip to content
Snippets Groups Projects
Commit 322c85ee authored by Chris Croome's avatar Chris Croome
Browse files

phpquery script updated

parent a06c527b
No related branches found
No related tags found
1 merge request!1Merge Sury
Pipeline #20893 passed
......@@ -6,61 +6,37 @@ PHPQUERY="{{ php_phpquery }}"
if [[ -f "${PHPQUERY}" ]]
then
declare -a versions
# echo "phpquery found at: ${PHPQUERY}" >&2
# echo "PHP versions command to be run: ${PHPQUERY} -V | sort -V" >&2
declare -a versions=()
readarray -t versions < <("${PHPQUERY}" -V | sort -V)
# echo "PHP versions found: ${versions[@]}" >&2
jo state=present versions=$(
jo $(
# echo Loop through the PHP versions >&2
for v in "${versions[@]}"
do
declare -a sapis
# echo "Query SAPIs for PHP version ${v}" >&2
# echo "PHP ${v} SAPIs command to be run: ${PHPQUERY} -v ${v} -S | sort" >&2
declare -a mods_available=()
readarray -t mods_available < <("${PHPQUERY}" -v "${v}" -M | sort)
declare -a sapis=()
readarray -t sapis < <("${PHPQUERY}" -v "${v}" -S | sort)
# echo "SAPIs found for PHP version ${v}: ${sapis[@]}" >&2
echo ${v}=$(
jo state=present $(
# echo "Loop through the SAPIs" >&2
for s in "${sapis[@]}"
do
declare -a mods_enabled
declare -a mods_disabled
# echo "Looping through the SAPIs for PHP ${v} starting with ${s}" >&2
# echo "PHP ${v} SAPI ${s} Modules command to be run: ${PHPQUERY} -v ${v} -s ${s} -M | sort" >&2
readarray -t mods < <("${PHPQUERY}" -v "${v}" -s "${s}" -M | sort)
# echo "Mods found for PHP ${v} SAPI ${s}: ${mods[@]}" >&2
# echo "Loop through the Mods found" >&2
for m in "${mods[@]}"
jo state=present mods_available=$(
jo -a "${mods_available[@]}") $(
for s in "${sapis[@]}"
do
# echo "Checking the status for PHP ${v} SAPI ${s} Mod ${m}" >&2
if "${PHPQUERY}" -v "${v}" -s "${s}" -m "${m}" -q; then
# echo "Mod enabled for PHP version ${v} SAPI ${s}: ${m}" >&2
mods_enabled=(${mods_enabled[@]} ${m})
# echo "Mods enabled for PHP version ${v} SAPI ${s}: ${mods_enabled[*]}" >&2
else
mods_disabled=(${mods_disabled[@]} ${m})
# echo "Mod disabled for PHP version ${v} SAPI ${s}: ${m}" >&2
fi
# echo "Done checking the status for PHP ${v} SAPI ${s} Mod ${m}" >&2
done
# echo "mods_available: ${mods[@]}" >&2
# echo "mods_enabled: ${mods_enabled[@]}" >&2
# echo "mods_disabled: ${mods_disabled[@]}" >&2
echo sapis["${s}"]=$(
jo state=present mods_available=$(
jo -e -a "${mods[@]}"
) mods_enabled=$(
jo -e -a "${mods_enabled[@]}"
) mods_disabled=$(
jo -e -a "${mods_disabled[@]}"
declare -a mods_enabled=()
for m in "${mods_available[@]}"
do
if "${PHPQUERY}" -v "${v}" -s "${s}" -m "${m}" -q
then
mods_enabled=(${mods_enabled[@]} ${m})
fi
done
echo sapis["${s}"]=$(
jo state=present mods_enabled=$(
jo -e -a "${mods_enabled[@]}"
)
)
)
done
done
)
)
)
done
)
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment