diff --git a/README.md b/README.md index 2a1ae62..7ab75a4 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, e - **Trusted Proxy Support**: Configurable trusted proxies for accurate rate limiting behind CDNs - **Checkout Blocks**: Full support for WooCommerce Checkout Blocks (default since WC 8.3+) - **Self-Licensing**: The plugin can validate its own license (for commercial distribution) +- **WordPress Auto-Updates**: Receive plugin updates through WordPress's native update system +- **Automated Releases**: CI/CD pipeline for consistent release packaging ### Customer Features @@ -340,6 +342,41 @@ Content-Type: application/json | `max_activations_reached` | Maximum activations reached | | `rate_limit_exceeded` | Too many requests (wait and retry) | +## Auto-Updates + +Licensed plugins can receive updates through WordPress's native plugin update system. When properly configured, WordPress will check the license server for updates and display them in the Plugins page. + +### Configuration + +In WooCommerce > Settings > Licensed Products > Auto-Updates: + +- **Enable Update Notifications**: Show available updates in WordPress admin +- **Automatically Install Updates**: Let WordPress install updates automatically +- **Update Check Frequency**: How often to check for updates (1-168 hours) + +### How It Works + +1. The plugin periodically checks the configured license server for updates +2. If a newer version is available and the license is valid, WordPress shows the update +3. Updates can be installed manually or automatically (if enabled) +4. Downloads are authenticated using the license key + +### API Endpoint + +The update check uses the `/update-check` REST API endpoint: + +```http +POST /wp-json/wc-licensed-product/v1/update-check +Content-Type: application/json + +{ + "license_key": "XXXX-XXXX-XXXX-XXXX", + "domain": "example.com", + "plugin_slug": "my-plugin", + "current_version": "1.0.0" +} +``` + ## License Statuses - **Active**: License is valid and usable @@ -369,6 +406,60 @@ For issues and feature requests, please visit: Marco Graetsch +## Development + +### Setup + +After cloning the repository, initialize the git submodule and install dependencies: + +```bash +git clone https://src.bundespruefstelle.ch/magdev/wc-licensed-product.git +cd wc-licensed-product +git submodule update --init --recursive +composer install +``` + +### Project Structure + +- `src/` - PHP source files (PSR-4 autoloaded) +- `assets/` - CSS and JavaScript files +- `templates/` - Twig templates for admin and frontend views +- `languages/` - Translation files (.pot, .po, .mo) +- `lib/` - Git submodule for the client library +- `docs/` - API documentation and client examples + +### Creating Releases + +Releases are automatically created by the Gitea CI/CD pipeline when a version tag is pushed: + +```bash +# Update version in wc-licensed-product.php (both header and constant) +# Update CHANGELOG.md with release notes +git add -A && git commit -m "Release v0.7.3" +git tag -a v0.7.3 -m "Release v0.7.3" +git push origin main --tags +``` + +The pipeline will: + +1. Build production dependencies +2. Compile translations +3. Create the release package with proper WordPress structure +4. Generate SHA256 checksum +5. Publish to Gitea releases + +### Translations + +To add or update translations: + +```bash +# Extract strings to .pot template +# (Use a tool like wp-cli or poedit) + +# Compile .po files to .mo for production +for po in languages/*.po; do msgfmt -o "${po%.po}.mo" "$po"; done +``` + ## License GPL-2.0-or-later