Fix AnalyticsController being garbage collected

Store the AnalyticsController instance as a class property
to prevent it from being garbage collected before WordPress
can call the registered callbacks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 00:06:28 +01:00
parent a73b7cc550
commit 27dc1b67c5

View File

@@ -57,6 +57,11 @@ final class Plugin
*/ */
private DownloadController $downloadController; private DownloadController $downloadController;
/**
* Analytics controller
*/
private ?AnalyticsController $analyticsController = null;
/** /**
* Get singleton instance * Get singleton instance
*/ */
@@ -134,7 +139,8 @@ final class Plugin
new VersionAdminController($this->versionManager); new VersionAdminController($this->versionManager);
new OrderLicenseController($this->licenseManager); new OrderLicenseController($this->licenseManager);
new SettingsController(); new SettingsController();
(new AnalyticsController($this->licenseManager))->init(); $this->analyticsController = new AnalyticsController($this->licenseManager);
$this->analyticsController->init();
} }
} }