Created
January 4, 2016 14:38
-
-
Save gwenhael-le-moine/bc334a2b35bbf8926a35 to your computer and use it in GitHub Desktop.
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/sh | |
CWD=$(pwd) | |
TMP=/tmp | |
WPs_ROOT=/home/cycojesus/www | |
function update_WordPress() { | |
echo "Treating $1:" | |
echo -n " - Fixing permissions... " | |
chown -R apache:apache $1 | |
find $1 -type f -exec chmod 664 {} \; | |
find $1 -type d -exec chmod 775 {} \; | |
chmod 777 $1/wp-content/ | |
echo "OK" | |
echo -n " - Updating core..." | |
sudo -u apache wp-cli --path=$1 core update 1> /dev/null && echo "OK" || echo "KO" | |
echo -n " - Updating plugins..." | |
sudo -u apache wp-cli --path=$1 plugin update --all 1> /dev/null && echo "OK" || echo "KO" | |
echo -n " - Updating themes..." | |
sudo -u apache wp-cli --path=$1 theme update --all 1> /dev/null && echo "OK" || echo "KO" | |
} | |
# commandline arguments processing | |
while [ "x$1" != "x" ] | |
do | |
case "$1" in | |
--root ) | |
shift | |
WPs_ROOT=$1 | |
shift | |
;; | |
--one ) | |
shift | |
update_WordPress $1 | |
shift | |
;; | |
--all ) | |
for i in $(find $WPs_ROOT -maxdepth 2 -name wp-config-sample.php -exec dirname {} \;); do | |
update_WordPress $i | |
done | |
;; | |
* ) | |
echo Usage: "$0 --all | --root <path> | --one <path>" | |
shift | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment