Last active
August 16, 2022 14:19
-
-
Save tangrufus/bb5ee813ec9c70b0e61a29279cb93cb2 to your computer and use it in GitHub Desktop.
Check whether a plugin is avticated on each sites in a network on WP VIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
app='@theApp.theEnv' | |
plugin='wordpress-seo' | |
echo "Checking whether plugin ${plugin} is activated on ${app}" | |
echo 'Fetching URLs' | |
urls=$(vip "${app}" --yes -- wp site list --fields="url" --format="csv" --quiet --no-color) | |
for url in $urls | |
do | |
if [ "${url}" == "url" ]; then | |
continue # skip the CSV header | |
fi | |
echo "Checking ${url}" | |
out=$(vip "${app}" wp --yes -- plugin list --name="${plugin}" --url="${url}" --status=active,active-network,dropin,must-use --skip-update-check --format=count --quiet --no-color) | |
if [[ ${out: -2} =~ ^1 ]]; then | |
echo "*** Plugin ${plugin} is activated on ${url}" | |
fi | |
done | |
echo 'Done.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment