-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Welcome to the wordpress-updater wiki!
Simple, first you need WP-CLI installed. Please visit The WP-CLI Homepage for more details.
Now that you have WP-CLI installed, let's install wordpressupdater:
apt install python3-pip # or whatever that gets you the pip3 command
pip3 install wordpressupdater
The above commands will give you a wpupdater script you can run.
wpupdater --help will show you a nice list of options:
$ wpupdater --help
usage: wpupdater [-h] [-t REQUIREDTAGS] [--allow-root] [--list-only] [-C] [-P]
[-T] [-A] [-E] [--full] [-v]
file [file ...]
Tool that implements wp-cli maintenance tasks on servers that use Apache2,
with a few useful features on DigitalOcean droplets. Future versions may
support nginx/lighttpd. Author: Buanzo - https://www.github.com/buanzo
positional arguments:
file Path to configuration files to extract DocumentRoots
from.
optional arguments:
-h, --help show this help message and exit
-t REQUIREDTAGS, --tags REQUIREDTAGS
Comma-separated list of required droplet tags. All
tags must be assigned to droplet for maintenance to
happen. May be used multiple times.
--allow-root Enables usage of this script as root. AVOID.
--list-only List Wordpress installations that were found.
-C, --update-core Apply WP Core updates.
-P, --update-plugins Update all plugins.
-T, --update-themes Update all themes.
-A, --update-all Updates core, plugins and themes.
-E, --delete-expired-transients
Updates core, plugins and themes.
--full Updates all, and deletes expired transients.
-v, --verbose Be more verbose.
If you manage permissions correctly, you will NEVER need to use --allow-root. But WP-CLI supports --allow-root so I do, too.
In a standard, modern Apache2 setup, you will use a2ensite to enable configuration files that sit in /etc/apache2/sites-available by having them linked from /etc/apache2/sites-enabled. Let's run this command (adapt to your needs)
wpupdater /etc/apache2/sites-enabled/*.conf --allow-root --list-only
Or even better:
sudo -u www-data wpupdater /etc/apache2/sites-enabled/*.conf --list-only
This will ugly-print a list of wordpress installations it finds under the DocumentRoot of each VirtualHost that is configured in the /etc/apache2/sites-enabled/*.conf files (well, symbolic links). It will do nothing else but list whatever it found.
You can add --verbose for more information!
Now, let's update the wordpress core AND plugins AND themes for all of those:
sudo -u www-data wpupdater /etc/apache2/sites-enabled/*.conf --update-all
And that's it.