The V-WordPress-Plugin-Updater is a dual-component system designed to streamline WordPress plugin and theme updates through a centralized management approach:
-
Update API Server (
v-update-api/): A standalone PHP web application that hosts and serves plugin/theme update packages. Built with a modern MVC architecture using FastRoute for routing, Doctrine DBAL for SQLite database management, and comprehensive security features including encrypted API keys, IP blacklisting, and session management. -
WordPress Client Plugin (
v-wp-updater/): A WordPress plugin that automatically checks for and installs updates from the API server. It integrates seamlessly with WordPress core update mechanisms, providing automated daily update checks, a dashboard settings widget for configuration, and comprehensive logging.
This architecture enables centralized control over plugin and theme updates across multiple WordPress installations, reducing manual maintenance overhead while maintaining security and reliability. The system supports both single-site and multisite WordPress installations and provides detailed logging and monitoring capabilities through an intuitive web-based admin interface.
| Component | Details | |
|---|---|---|
| βοΈ | Architecture |
|
| π© | Code Quality |
|
| π | Documentation |
|
| π | Integrations |
|
| π§© | Modularity |
|
| π§ͺ | Testing |
|
| β‘οΈ | Performance |
|
| π‘οΈ | Security |
|
| π¦ | Dependencies |
|
βββ v-wordpress-plugin-updater/
βββ .github/
β βββ copilot-instructions.md
βββ LICENSE
βββ README.md
βββ tests/
βββ v-update-api/ # Update API server
β βββ app/
β β βββ Controllers/
β β βββ Core/
β β β βββ DatabaseManager.php
β β β βββ ErrorManager.php
β β β βββ Request.php
β β β βββ Response.php
β β β βββ Router.php
β β βββ Helpers/
β β βββ Models/
β β βββ Views/
β βββ public/
β β βββ index.php
β β βββ install.php
β βββ storage/
β β βββ logs/
β β βββ plugins/
β β βββ themes/
β β βββ updater.sqlite
β βββ composer.json
β βββ config.php
β βββ cron.php
βββ v-wp-updater/ # WordPress client plugin
β βββ helpers/
β βββ services/
β βββ widgets/
β βββ install.php
β βββ uninstall.php
β βββ v-wp-updater.php # Main plugin fileSystem Requirements:
- PHP: version 8.2 or higher for
v-update-api/; version 8.0 or higher forv-wp-updater/ - Web Server: Apache, Nginx or any server capable of running PHP
- Write Permissions: ensure the web server can write to
/storage
-
Clone or download this repository to your web server.
-
Set
v-update-api/public/as your web server document root. -
Create the following directories so the Update API can store packages and logs:
mkdir -p v-update-api/storage/plugins mkdir -p v-update-api/storage/themes mkdir -p v-update-api/storage/logs
-
Edit
v-update-api/config.phpand set the login credentials and directory constants. AdjustVALID_USERNAME,VALID_PASSWORD,LOG_FILE, and paths underBASE_DIRif the defaults do not match your setup. The Update API requires PHP 8.2 or higher. -
Set the
ENCRYPTION_KEYconstant inv-update-api/config.phpto secure host keys (AES-256-GCM encryption):# In v-update-api/config.php define('ENCRYPTION_KEY', 'replace-with-a-long-random-secret');
-
Ensure the web server user owns the
v-update-api/storage/directory so uploads and logs can be written. Application logs are written toLOG_FILE(defaultv-update-api/storage/logs/app.log). -
Navigate to
v-update-api/public/and runphp install.phpin your browser or via CLI to create the SQLite database and required tables. Ensurev-update-api/storage/updater.sqliteis writable by the web server. -
Configure a system cron to run once daily (the script is CLI-only and takes no arguments):
0 2 * * * cd /path/to/v-update-api && php cron.php
This keeps the database in sync with plugin and theme ZIP files in the storage directories and also cleans up expired blacklist entries.
-
Copy the
v-wp-updater/directory to your WordPress installation'swp-content/plugins/directory. -
Configure the API server URL and API key in WordPress using the dashboard settings widget or via provisioning:
update_option('vwpu_update_plugin_url', 'https://updates.example.com/api'); update_option('vwpu_update_theme_url', 'https://updates.example.com/api'); update_option('vwpu_update_key', 'your-api-key-from-server');
Alternatively, navigate to the WordPress Dashboard β Settings widget (V WordPress Updater Settings) after activation to configure these values via the admin UI.
-
Activate the plugin through the WordPress admin panel or WP-CLI.
-
The plugin will automatically schedule daily update checks for plugins and themes.
Note: When a host entry is created or its key regenerated in the Update API admin panel, update the client installation with the new key using your provisioning process.
-
Log in to the Update API admin panel by visiting
https://your-update-server.com/loginusing the credentials configured inv-update-api/config.php. -
Manage Hosts: Add authorized WordPress domains and generate API keys in the
/homeroute. -
Upload Plugins: Navigate to
/plupdateto upload plugin ZIP files. Files must be named following the pattern{slug}_{version}.zip(e.g.,my-plugin_1.2.3.zip). -
Upload Themes: Navigate to
/thupdateto upload theme ZIP files. Files must follow the same naming pattern as plugins. -
View Logs: Check
/logsfor plugin and theme update activity logs. -
The daily cron job will automatically sync uploaded files to the database. Ensure the cron job is configured as described in the installation steps.
Once activated, the V WordPress Plugin Updater automatically:
- Schedules daily update checks for all installed plugins and themes
- Contacts the Update API server to check for available updates
- Downloads and installs updates when newer versions are available
- Logs all update activities for troubleshooting
You can manually trigger update checks or view logs through the plugin's settings page in the WordPress admin panel.
The Update API provides endpoints for checking and retrieving plugin and theme updates.
Base URL: /api
Method: GET
| Parameter | Type | Description | Example |
|---|---|---|---|
type |
string | Type of update (plugin or theme) | plugin or theme |
domain |
string | Domain making the request | example.com |
key |
string | API key for authentication | your-api-key |
slug |
string | Plugin or theme slug | my-plugin |
version |
string | Current installed version | 1.0.0 |
| Code | Description |
|---|---|
200 OK |
Update available, returns update package |
204 No Content |
No update available, current version is up to date |
400 Bad Request |
Missing/invalid request parameters (does not consume blacklist budget) |
403 Forbidden |
Invalid authentication credentials, unknown domain, or IP blacklisted |
404 Not Found |
Authenticated request references an unknown plugin/theme slug |
405 Method Not Allowed |
Request used a non-GET method |
500 Internal Server Error |
Update file is missing/unreadable on server |
GET /api?type=plugin&domain=example.com&key=your-api-key&slug=my-plugin&version=1.0.0
Status: 200 OK
Headers:
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="my-plugin_1.1.0.zip"
Body: Binary ZIP file contents
Status: 204 No Content
No response body.
The WordPress client plugin (v-wp-updater) implements this contract in
PluginUpdater::fetch_package and ThemeUpdater::fetch_package:
- Sends
type=pluginortype=theme(not a separateplugin/themeparameter). - Sends
slug=<plugin-or-theme-slug>for the resource identifier (including single-file plugin slugs). - On
200: stores the ZIP response body in a temporary local file and reuses that file during install (avoids a second download). - On
204: returnsno_update; no installation is attempted. - On
403: returnsunauthorized; the failure is logged. (401is not returned by this API.) - On
404: returnserror(authenticated slug not found). - On any other code or network error: returns
error.
- All requests are logged with domain, date, and status
- Failed authentication attempts (unknown domain / wrong key) are tracked per IP address
- Malformed requests (
400) and authenticated unknown slugs (404) do not increment blacklist attempts - IPs are automatically blacklisted after 3 failed authentication attempts
- Blacklisted IPs are automatically removed after 7 days
- Non-blacklisted IPs with no activity are removed after 3 days
The API uses IP-based blacklisting for rate limiting. After 3 failed authentication attempts, an IP will be blacklisted for 7 days.
-
Task 1:Convert to MVC framework -
Task 2:Implement more advanced authorization for site connections -
Task 3:Implement Database instead of useing filesystem
V-wordpress-plugin-updater is protected under the LICENSE License. For more details, refer to the LICENSE file.
