I’ve seen these two resources discussed and mentioned elsewhere, I’d love to see opinions on them.
pluginstxt - plugins.txt aims to decentralize plugin hosting by allowing developers to self-host and provide necessary metadata for discovery, verification, and secure communication.
Git Updater - A simple plugin to enable automatic updates to your GitHub hosted WordPress plugins, themes, and language packs. Additional API plugins available for Bitbucket, GitLab, Gitea, and Gist.
Many plugins by CP developers used a version of GitUpdater. Sure, it works, but it provides no visibility.
Since we built the CP Directory to run on an instance of CP itself, pretty much everyone has instead chosen to have their plugin listed there and to use the updating function that provides.
Speaking purely for myself, I’d view a plugin that still uses its own Git Updater as taking a step backwards and wouldn’t use it.
I agree, I can see multiple issues depending on what route current WP devs/users choose. I am thinking if you submit your plugin to CP’s directory, your audience is here unless you decide to also support + maintain versions for other forks or WP.
I’m all for our directory, but now if you need to self host your updates the Update URI header and the relative hooks are the best way to do this without extra libraries and with extreme flexibility.
This is done using the header and the update_plugins_{$hostname} filter.
This is a PoC plugin that get update information from a simple endpoint (can also use a static json file).
/**
* Plugin Name: Update URI test
* Version: 1.0.0
* Update URI: https://educatorecinofilo.dog/myplugins.php
*/
namespace XXSimoXX\UURI;
class U_URI {
const UPDATE_URI = 'https://educatorecinofilo.dog/myplugins.php';
public function __construct() {
$update_plugins_hook = 'update_plugins_'.wp_parse_url(self::UPDATE_URI, PHP_URL_HOST);
add_filter($update_plugins_hook, [$this, 'update_uri_filter'], 10, 4);
}
public function update_uri_filter($update, $plugin_data, $plugin_file, $locales) {
$response = wp_remote_get(self::UPDATE_URI);
$remote_data = json_decode(wp_remote_retrieve_body($response), true);
$plugin_remote_data = $remote_data[dirname($plugin_file)];
if (version_compare($plugin_data['Version'], $plugin_remote_data['Version']) >= 0) {
// No updates available
return false;
}
return [
'slug' => $plugin_file,
'version' => $plugin_remote_data['Version'],
'package' => $plugin_remote_data['Download'],
];
}
}
new U_URI();
I want to turn this into a self-managed plugin, so you can manage the files, the JSON code and the releases from your own WordPress/ClassicPress installation. I started a thread a while ago, here - Selling plugins and themes
It’s the same way Update Manager handles updates, filtering pre_set_site_transient_update_plugins.
ClassicPress Directory Integration plugin uses the new hook update_plugins_{$hostname} that was created to achieve this result.