From eb8818aa812c4d1a85b1358bc8a5492d7de9677f Mon Sep 17 00:00:00 2001 From: magdev Date: Tue, 27 Jan 2026 20:17:20 +0100 Subject: [PATCH] Update CLAUDE.md with v0.6.0 session history - Document WordPress auto-update system implementation - Add /update-check endpoint to REST API table - Add Update/ directory to project structure - Add Email/ directory to project structure - Update temporary roadmap to v0.7.0 Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 8 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 3a202bb..cb059b4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,7 +32,7 @@ This project is proudly **"vibe-coded"** using Claude.AI - the entire codebase w **Note for AI Assistants:** Clean this section after the specific features are done or new releases are made. Effective changes are tracked in `CHANGELOG.md`. Do not add completed versions here - document them in the Session History section at the end of this file. -### Version 0.6.0 +### Version 0.7.0 *No planned features yet.* @@ -197,11 +197,13 @@ wc-licensed-product/ ├── releases/ # Release packages (version 0.1.0+) ├── src/ │ ├── Admin/ # AdminController - license management UI -│ ├── Api/ # RestApiController - license validation endpoints +│ ├── Api/ # RestApiController, UpdateController - REST API endpoints │ ├── Checkout/ # CheckoutController - domain field at checkout +│ ├── Email/ # WooCommerce email classes │ ├── Frontend/ # AccountController - customer licenses page │ ├── License/ # License model and LicenseManager -│ └── Product/ # LicensedProduct type and LicensedProductType +│ ├── Product/ # LicensedProduct type and LicensedProductType +│ └── Update/ # PluginUpdateChecker - WordPress auto-update integration ├── templates/ │ ├── admin/ # Twig templates for admin views │ └── frontend/ # Twig templates for customer views @@ -219,11 +221,12 @@ Created on plugin activation via `Installer::createTables()`: Base: `/wp-json/wc-licensed-product/v1/` -| Endpoint | Method | Description | -| ----------- | ------ | ------------------------------- | -| `/validate` | POST | Validate license key for domain | -| `/status` | POST | Get license status | -| `/activate` | POST | Activate license on domain | +| Endpoint | Method | Description | +| --------------- | ------ | ---------------------------------- | +| `/validate` | POST | Validate license key for domain | +| `/status` | POST | Get license status | +| `/activate` | POST | Activate license on domain | +| `/update-check` | POST | Check for plugin updates (v0.6.0+) | Full API documentation available in `openapi.json` (OpenAPI 3.1 specification). @@ -1656,3 +1659,76 @@ Fixed tab rendering bug in WooCommerce product edit page when switching to licen - Created release package: `releases/wc-licensed-product-0.5.15.zip` (862 KB) - SHA256: `47407de49bae4c649644af64e87b44b32fb30eeb2d50890ff8c4bbb741059278` - Committed to `dev` branch + +### 2026-01-27 - Version 0.6.0 - WordPress Auto-Update System + +**Overview:** + +Major feature release implementing WordPress-style automatic updates. Licensed plugins can now receive updates through WordPress's native plugin update mechanism by checking against the license server. + +**New files:** + +- `src/Api/UpdateController.php` - Server-side REST API endpoint for update checks +- `src/Update/PluginUpdateChecker.php` - Client-side singleton for WordPress update integration + +**Implemented:** + +- Server-side `/update-check` REST API endpoint serving WordPress-compatible update information +- Client-side `PluginUpdateChecker` singleton hooking into WordPress's native update system +- Hooks: `pre_set_site_transient_update_plugins`, `plugins_api`, `http_request_args` +- New "Auto-Updates" settings subtab with enable/disable toggle and check frequency +- Configurable cache TTL for update checks (1-168 hours, default: 12) +- Secure download authentication via `X-License-Key` header +- Response signing support for tamper-proof update responses + +**Modified files:** + +- `src/Plugin.php` - Added UpdateController and PluginUpdateChecker initialization +- `src/Admin/SettingsController.php` - Added 'auto-updates' section with settings +- `openapi.json` - Documented `/update-check` endpoint with request/response schemas +- `languages/*` - Updated translations for new strings + +**Settings Controller Changes:** + +- Added `'auto-updates'` to `getSections()` for sub-tab navigation +- New `getAutoUpdatesSettings()` method returning enable/frequency settings +- New static methods: `isAutoUpdateEnabled()`, `getUpdateCheckFrequency()` + +**UpdateController API:** + +- Endpoint: `POST /wp-json/wc-licensed-product/v1/update-check` +- Request: `license_key`, `domain`, `plugin_slug` (optional), `current_version` (optional) +- Response: `update_available`, `version`, `download_url`, `package`, `changelog`, `tested`, `requires`, `requires_php`, etc. +- License validation before serving update info +- Secure download URL generation using existing DownloadController patterns + +**PluginUpdateChecker Features:** + +- Singleton pattern with `getInstance()` +- Caching via WordPress transients (`wclp_update_info`) +- Automatic cache clearing on settings save +- Only activates when license server URL is configured and not self-licensing +- `forceUpdateCheck()` method for manual refresh + +**Configuration:** + +To disable auto-updates programmatically: + +```php +define('WC_LICENSE_DISABLE_AUTO_UPDATE', true); +``` + +**Technical notes:** + +- Update checker only registers when `SettingsController::getPluginLicenseServerUrl()` returns a value +- Self-licensing detection prevents circular update checks (via `PluginLicenseChecker::isSelfLicensing()`) +- Download URLs include license key in `X-License-Key` header for server-side verification +- Uses Symfony HttpClient for server requests with 15s timeout +- Cache TTL configurable from 1-168 hours in settings +- OpenAPI spec updated to version 0.6.0 with full `/update-check` documentation + +**Release v0.6.0:** + +- Created release package: `releases/wc-licensed-product-0.6.0.zip` (1.1 MB) +- SHA256: `171c8195c586b3b20bac4a806e2d698cdaaf15966e2fd6e1670ec39dac8ab027` +- Tagged as `v0.6.0` and pushed to `main` branch