Skip to content

Instantly share code, notes, and snippets.

@n8finch
Last active March 3, 2020 20:48
Show Gist options
  • Save n8finch/b9144cc07281383318342645bc9d54e9 to your computer and use it in GitHub Desktop.
Save n8finch/b9144cc07281383318342645bc9d54e9 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Double-check you're ready to rock and roll with an update
read -r -p "Are you sure you want to update all specified directories? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
#Set the array of folders
DIRECTORIES=( 'wordpress-default' 'wordpress-develop' );
#For each item in array, run the commands
for dir in ${DIRECTORIES[@]} ; do
cd ${dir}/public_html;
echo "";
echo "";
echo "*****************************************************" ;
echo "UPDATING: " ${dir} " in " `pwd` ;
echo "*****************************************************" ;
echo "";
echo "";
wp theme update --all;
wp plugin update --all;
wp theme list;
wp plugin list;
wp core update;
wp checksum core;
wp db check;
echo '';
echo '';
echo "*****************************************************" ;
echo "UPDATE for ${dir} COMPLETE!" ;
echo "*****************************************************" ;
echo '';
echo '';
cd ../.. ;
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment