Created
October 4, 2017 14:20
-
-
Save dannygsmith/127666b417582c65aaafb5a2962a9996 to your computer and use it in GitHub Desktop.
Update local sites that are in hosts.txt
This file contains hidden or 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 | |
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 " " > /dev/null | |
echo " " > /dev/null | |
echo -e "Upgrading: " ${VP_BOLD}${VP_PURPLE}${PATH_STRING}${VP_NONE} > /dev/null | |
if [ 'phpmyadmin' != $PATH_STRING ]; then | |
# do wp-cli magic | |
bash -c 'wp core update' > /dev/null | |
bash -c 'wp plugin update --all' > /dev/null | |
bash -c 'wp theme update --all' > /dev/null | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment