Skip to content

Instantly share code, notes, and snippets.

@lukapaunovic lukapaunovic/
Last active Aug 25, 2018

What would you like to do?
Mass update WP core, themes & plugins - cPanel servers
# Script will not be updating themes. If you want to update themes uncomment last two lines
#Get latest WP-CLI
rm -rf /home/wp
wget --quiet -O /home/wp
chmod +x /home/wp
sleep 2
#Color play
# You can set /opt/cpanel/ea-php56/root/usr/bin/php
# here to avoid compatibility problems in MultiPHP environments.
# Start updating
echo -e "$Yellow Updating WP core $Color_Off";
for i in `ls --hide='system' /var/cpanel/users/`; do sudo -H -u $i cp /home/wp /home/$i/wp && sudo -H -u $i find /home/$i/public_html -name 'wp-admin' -execdir $PHP_PATH /home/$i/wp core update \; && sudo -H -u $i rm -rf /home/$i/wp ; done
echo -e "$Green Updating plugins $Color_Off";
for i in `ls --hide='system' /var/cpanel/users/`; do sudo -H -u $i cp /home/wp /home/$i/wp && sudo -H -u $i find /home/$i/public_html -name 'wp-admin' -execdir $PHP_PATH /home/$i/wp plugin update-all \; && sudo -H -u $i rm -rf /home/$i/wp ; done
#echo -e "$Red Updating themes $Color_Off";
#for i in `ls --hide='system' /var/cpanel/users/`; do sudo -H -u $i cp /home/wp /home/$i/wp && sudo -H -u $i find /home/$i/public_html -name 'wp-admin' -execdir $PHP_PATH /home/$i/wp theme update-all \; && sudo -H -u $i rm -rf /home/$i/wp ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.