You've already forked wc-licensed-product
Add WordPress auto-update functionality (v0.6.0)
- Add UpdateController REST API endpoint for serving update info to licensed plugins - Add PluginUpdateChecker singleton for client-side update checking - Hook into WordPress native plugin update system (pre_set_site_transient_update_plugins, plugins_api) - Add Auto-Updates settings subtab with enable/disable and check frequency options - Add authentication headers for secure download requests - Support configurable cache TTL for update checks (default 12 hours) - Document /update-check endpoint in OpenAPI specification - Update German translations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ use Jeremias\WcLicensedProduct\Admin\SettingsController;
|
||||
use Jeremias\WcLicensedProduct\Admin\VersionAdminController;
|
||||
use Jeremias\WcLicensedProduct\Api\ResponseSigner;
|
||||
use Jeremias\WcLicensedProduct\Api\RestApiController;
|
||||
use Jeremias\WcLicensedProduct\Api\UpdateController;
|
||||
use Jeremias\WcLicensedProduct\Checkout\CheckoutBlocksIntegration;
|
||||
use Jeremias\WcLicensedProduct\Checkout\CheckoutController;
|
||||
use Jeremias\WcLicensedProduct\Checkout\StoreApiExtension;
|
||||
@@ -27,6 +28,7 @@ use Jeremias\WcLicensedProduct\License\LicenseManager;
|
||||
use Jeremias\WcLicensedProduct\License\PluginLicenseChecker;
|
||||
use Jeremias\WcLicensedProduct\Product\LicensedProductType;
|
||||
use Jeremias\WcLicensedProduct\Product\VersionManager;
|
||||
use Jeremias\WcLicensedProduct\Update\PluginUpdateChecker;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
@@ -139,8 +141,9 @@ final class Plugin
|
||||
new AccountController($this->twig, $this->licenseManager, $this->versionManager, $this->downloadController);
|
||||
}
|
||||
|
||||
// Always initialize REST API and email controller
|
||||
// Always initialize REST API, update API, and email controller
|
||||
new RestApiController($this->licenseManager);
|
||||
new UpdateController($this->licenseManager, $this->versionManager);
|
||||
new LicenseEmailController($this->licenseManager);
|
||||
|
||||
// Initialize response signing if server secret is configured
|
||||
@@ -162,6 +165,12 @@ final class Plugin
|
||||
add_action('admin_notices', [$this, 'showUnlicensedNotice']);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize update checker if license server is configured (client-side updates)
|
||||
$serverUrl = SettingsController::getPluginLicenseServerUrl();
|
||||
if (!empty($serverUrl) && !$licenseChecker->isSelfLicensing()) {
|
||||
PluginUpdateChecker::getInstance()->register();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user