Last active
April 10, 2019 07:46
-
-
Save mjot/45cb1e98b46b33b6015862c850f075de to your computer and use it in GitHub Desktop.
update each wordpress plugin with wp-cli and commit each update with plugin name and version in commit message
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
#!/usr/bin/env bash | |
wp () { | |
command /usr/local/bin/php7.2.11-cli ~/wp-cli/wp-cli.phar "$@" | |
} | |
for plugins in $(wp plugin list --path='../html/' --update=available --fields=name,version,update_version --format=csv); | |
do | |
IFS=', ' read -r -a plugin <<< "$plugins" | |
if [ ${plugin[0]} = "name" ]; then | |
continue | |
fi | |
wp plugin update ${plugin[0]} --path='../html/' && | |
git add -A ../html/wp-content/plugins/${plugin[0]} && | |
git commit -m "Plugin update - ${plugin[0]} - ${plugin[1]} to ${plugin[2]}" | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script is located in a scripts folder next to the Wordpress installation. That's why the --path option is used.