You've already forked wc-licensed-product
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:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user