Git Updater Test Plugin WP Registry grade A-. Low-severity findings · 1 findingWP RegistryLow-severity findings · 1 findingOpen the reportA-
A WordPress plugin proof-of-concept, that uses an API agnostic implementation to intercept the default WordPress plugin update behavior.
Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/fabrikage/git-updater-test-plugin/releases/download/0.0.4/git-updater-test-plugin-0.0.4.zipA WordPress plugin that demonstrates remote plugin updates using repository releases API.
Disclaimer
This README file is incomplete and might not provide all the necessary information for using the plugin. Make sure to read through the source code for a better understanding of the plugin's functionality and configuration options.
Overview
This plugin serves as a demonstration of how to implement automatic updates for WordPress plugins using external repository hosting services. It sets up a system that connects to a repository's API, checks for new releases, and provides users with update notifications within the WordPress admin panel.
This repository serves as a proof-of-concept for the plugin's functionality. You can use it as a reference for implementing similar functionality in your own WordPress plugins.
Features
- Connects to external repository hosting service API (only GitHub for now)
- Authenticates with repository services using personal access tokens
- Fetches release information including version numbers, changelog, and download URLs
- Provides update notifications in WordPress admin when a new version is available
- Handles the update process through WordPress's built-in updater system
Configuration
The plugin can be configured to check for updates from any compatible repository. The access token must have appropriate permissions to access the repository.
How It Works
The plugin uses the following components:
ClientInterfaceclass: Handles communication with the repository APIUpdateCheckerclass: Integrates with WordPress update systemBootstrapclass: Initializes the plugin and sets up the update system
The update process follows these steps:
- The plugin checks for new releases on the remote with the
pre_set_site_transient_update_pluginshook - It compares the current version with the latest release version
- If a newer version is available, it displays an update notification
- When the user initiates the update, it downloads the new version from the repository
Requirements
- WordPress 5.0 or higher
- PHP 8.0 or higher
- Repository access token with appropriate permissions
Development
For developers, the plugin includes a CI/CD workflow that automatically creates releases when tags are pushed. The workflow:
- Generates a changelog from commits
- Prepares the plugin files for distribution
- Creates a ZIP file with the appropriate version number
- Uploads the ZIP file as a release asset
Releases
4 releases. Each count is every asset in that release; expand a row for the breakdown.