Skip to content

Instantly share code, notes, and snippets.

@dannygsmith
Created October 3, 2017 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannygsmith/d70f42f035d23365ca8c3ae9be7a4b7c to your computer and use it in GitHub Desktop.
Save dannygsmith/d70f42f035d23365ca8c3ae9be7a4b7c to your computer and use it in GitHub Desktop.
This script will update all themes and plugins
#!/usr/bin/env bash
export PATH="/usr/local/bin:$PATH";
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
VP_BOLD='\033[1m'
VP_UNDERLINE='\033[4m'
# This script will update all themes and plugins
#
# To execute this file, copy it to the folder where your websites live.
# For DesktopServer the folder is probably called Websites/
#
# Navigate to the path in Terminal and type the following command:
# sh wp-cli-updates.sh
mypwd="${HOME}/Sites"
readarray paths < "${HOME}/bin/hosts.txt"
for PATH_STRING in "${paths[@]}"
do
#echo $PATH_STRING
# change to correct directory
cd $mypwd/$PATH_STRING
# prompt user of upgrade
echo " "
echo " "
echo -e "Upgrading: " ${VP_BOLD}${VP_PURPLE}${PATH_STRING}${VP_NONE}
if [ 'phpmyadmin' != $PATH_STRING ]; then
# do wp-cli magic
bash -c 'wp core update'
bash -c 'wp plugin update --all'
bash -c 'wp theme update --all'
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment