Plugins: Control Plugin and Core Updates and Auto-Updates

Plugins: Control Plugin and Core Updates and Auto-Updates

How to update Premium Plugins?

For checking for plugin updates, we will use this plugin: wp-kitten/envato-update-plugins. This plugin extends standard Wordpress mechanism - informs about updates and enables automatic update.

For this plugin to work, we need Envato username and API key generated on this page.

How to update Premium Themes?

For themes we should use plugin Envato WordPress Toolkit: envato/envato-wordpress-toolkit

Tuning Update Check

By default, plugin update check will happen on 12 hours. But, if you want to force it immediately, just remove one transient value in options table.

You can force plugin checks - to demonstrate plugin update - first change version number in a header (comments) of a plugin’s main PHP, for the plugin that you want to simulate update. file.

You can also force plugin update check from database update:

mysql --host=<HOST> --user=<USER> --password='<PASS>' -e "USE <DBNAME>; UPDATE wp_options set option_value='' where option_name='_site_transient_update_plugins';"

as explained in this article.

We can also install a plugin Force Plugin Updates Check to force plugin update check. It is a very simple plugin that adds a link to the admin-toolbar.

Note: There is an option in admin area to force update check. But, I’m not sure if it triggers update check only for core or also for plugins.

Development

There is a cute way to show notifications next to the plugin before it is updated - when update is suggested. I really need this to warn the user if we changed something in that plugin, and we must take special care after updating it.

Hook used for that is in_plugin_update_message-{folder}/{file}, where folder and file are from wp-plugins directory, for example for plugin W3TC it is w3-total-cache/w3-total-cache.php;

Centralized plugin updates from GitHub and such

Automatic update of plugins, also from private repositories: GitHub Updater, which was also expelled from official wp.org repo.

We can use it to distribute updates of our private plugins to multiple sites or to update heavily modified plugins that we use on multiple sites (WP All Import, etc).

There is a similar project WP Pusher but only for public repositories.


Private Package Repositories

There is an amazing project actively maintained from respected author, similar to SatisPress, but for Zip archives rarst/release-belt

SatisPress

To maintain paid and private plugins and themes, you could create a repo for everyone of them and distribute and update them in that way. But better option is to have a private composer repository for private plugin management

There are multitude of ways to create a private composer repository, but the most clever one is a plugin named SatisPress. The same authors are announcing some more modern alternative in the future, Crate, but for me now this is almost perfect.

Setup SatisPress

The most tricky part form me was to discover that you must visit Settings → Permalinks page and set them to Post name or similar. That will force a flushing of the site’s permalinks and enable the SatisPress URL for packages.json to start working.

As for the SatisPress security the basic HTTP authentication is used by default.

Create a token in SatisPress and confirm it’s working:

curl https://token:satispress@wpack.savioko.com/satispress/packages.json

Now we can instruct composer to install that repository with a <token> specified as username and satispress as password.

Interesting manuals are satispress/composer.md and handling-private-packages-with-satis

We could specify authentication token like below but then this token will be exposed in Git for everybody.

composer config repositories.satispress composer https://<token>:satispress@wpack.savioko.com/satispress/packages.json

Much better way is to have credentials in separate file, out of Git:

composer config repositories.satispress composer https://wpack.savioko.com/satispress/packages.json
composer config http-basic.wpack.savioko.com <token> satispress

This will create auth.json file sitting besides your composer.json with your credentials as explained in this example.

SatisPress Usage

As everything is working now, type the following to install some theme or plugin:

composer require satispress/anahata satispress/anahata-child

date 18. Dec 2015 | modified 24. Jun 2022
filename: Plugins » Update Control