From 2b9b87aea1318e208dc7a429d9f64235f3dd17ae Mon Sep 17 00:00:00 2001 From: Joe Huss Date: Thu, 13 Aug 2026 21:38:12 -0400 Subject: [PATCH 1/2] remove the plugin.install / plugin.uninstall hooks nothing dispatches Both were registered as literal 'plugin.*' keys while this plugin declares $module = 'licenses', and no run_event('plugin.install') exists anywhere in core -- so neither handler has ever been reachable. The service categories and prices getInstall() declared (CloudLinux $10, KernelCare $2.95, Imunify tiers) are long out of date and were never applied by anything. Owner-approved removal, per D-2 in docs/plugin-harness-findings.md. The assertions that named the two handlers go with them -- their subject no longer exists, so this is coverage following code rather than coverage dropped. tests/ContractTest.php is regenerated rather than hand-edited: it pins the hook table's shape, which is exactly what changed. Found by the shared contract harness (B-9b, hook keys are dispatched). Co-Authored-By: Claude Opus 5 (1M context) --- src/Plugin.php | 29 ----------------------------- tests/ContractTest.php | 2 -- tests/PluginTest.php | 10 ++-------- tests/SourceFileAnalysisTest.php | 13 ------------- 4 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index e6b1e1f..23a4952 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -32,8 +32,6 @@ public function __construct() public static function getHooks() { return [ - 'plugin.install' => [__CLASS__, 'getInstall'], - 'plugin.uninstall' => [__CLASS__, 'getUninstall'], self::$module.'.settings' => [__CLASS__, 'getSettings'], self::$module.'.activate' => [__CLASS__, 'getActivate'], self::$module.'.reactivate' => [__CLASS__, 'getActivate'], @@ -45,33 +43,6 @@ public static function getHooks() ]; } - /** - * @param \Symfony\Component\EventDispatcher\GenericEvent $event - */ - public static function getInstall(GenericEvent $event) - { - $plugin = $event->getSubject(); - $serviceCategory = $plugin->addServiceCategory(self::$module, 'cloudlinux', 'CloudLinux'); - $plugin->addDefine('SERVICE_TYPES_CLOUDLINUX', $serviceCategory); - $serviceType = $plugin->addServiceType($serviceCategory, self::$module, 'CloudLinux'); - $plugin->addService($serviceCategory, $serviceType, self::$module, 'CloudLinux License', 10.00, 0, 1, 1, ''); - $plugin->addService($serviceCategory, $serviceType, self::$module, 'KernelCare License', 2.95, 0, 1, 16, ''); - $plugin->addService($serviceCategory, $serviceType, self::$module, 'ImunityAV+', 6, 0, 1, 40, ''); - $plugin->addService($serviceCategory, $serviceType, self::$module, 'Imunity360 single user', 12, 0, 1, 41, ''); - $plugin->addService($serviceCategory, $serviceType, self::$module, 'Imunity360 up to 30 users', 25, 0, 1, 42, ''); - $plugin->addService($serviceCategory, $serviceType, self::$module, 'Imunity360 up to 250 users', 35, 0, 1, 43, ''); - $plugin->addService($serviceCategory, $serviceType, self::$module, 'Imunity360 unlimited users', 45, 0, 1, 49, ''); - } - - /** - * @param \Symfony\Component\EventDispatcher\GenericEvent $event - */ - public static function getUninstall(GenericEvent $event) - { - $plugin = $event->getSubject(); - $plugin->disableServiceCategory(self::$module, 'cloudlinux'); - } - /** * @param \Symfony\Component\EventDispatcher\GenericEvent $event * @throws \Detain\Cloudlinux\XmlRpcException diff --git a/tests/ContractTest.php b/tests/ContractTest.php index 010469b..94a40c4 100644 --- a/tests/ContractTest.php +++ b/tests/ContractTest.php @@ -108,8 +108,6 @@ public function testRegistersItsIdentityAndHooks(): void $this->assertSame( [ - 'plugin.install', - 'plugin.uninstall', 'licenses.settings', 'licenses.activate', 'licenses.reactivate', diff --git a/tests/PluginTest.php b/tests/PluginTest.php index 2328885..c837de7 100644 --- a/tests/PluginTest.php +++ b/tests/PluginTest.php @@ -133,8 +133,6 @@ public function testGetHooksReturnsExpectedKeys(): void $this->assertIsArray($hooks); $expectedKeys = [ - 'plugin.install', - 'plugin.uninstall', 'licenses.settings', 'licenses.activate', 'licenses.reactivate', @@ -156,7 +154,7 @@ public function testGetHooksReturnsExpectedKeys(): void public function testGetHooksCount(): void { $hooks = Plugin::getHooks(); - $this->assertCount(10, $hooks); + $this->assertCount(8, $hooks); } /** @@ -207,8 +205,6 @@ public function testModuleBasedHookKeysUseCorrectPrefix(): void public function testEventHandlerMethodSignatures(): void { $eventMethods = [ - 'getInstall', - 'getUninstall', 'getActivate', 'getDeactivate', 'getDeactivateIp', @@ -276,7 +272,7 @@ public function testClassIsNotAbstractOrFinal(): void public function testPublicMethodCount(): void { $publicMethods = $this->reflection->getMethods(\ReflectionMethod::IS_PUBLIC); - $this->assertCount(11, $publicMethods); + $this->assertCount(9, $publicMethods); } /** @@ -286,8 +282,6 @@ public function testPublicMethodCount(): void public function testEventHandlerReturnTypes(): void { $eventMethods = [ - 'getInstall', - 'getUninstall', 'getActivate', 'getDeactivate', 'getDeactivateIp', diff --git a/tests/SourceFileAnalysisTest.php b/tests/SourceFileAnalysisTest.php index 91e81ed..8527e56 100644 --- a/tests/SourceFileAnalysisTest.php +++ b/tests/SourceFileAnalysisTest.php @@ -236,19 +236,6 @@ public function testPluginHasClassDocBlock(): void $this->assertStringContainsString('@package', $content); } - /** - * Tests that the getInstall handler registers multiple services. - * CloudLinux offers several license types: CloudLinux, KernelCare, and Imunify variants. - */ - public function testGetInstallRegistersMultipleServices(): void - { - $content = file_get_contents($this->srcDir . '/Plugin.php'); - $this->assertStringContainsString('CloudLinux License', $content); - $this->assertStringContainsString('KernelCare License', $content); - $this->assertStringContainsString('ImunityAV+', $content); - $this->assertStringContainsString('Imunity360', $content); - } - /** * Tests that the getRequirements handler registers all expected page/function requirements. */ From 7ff1fe9a42c85d2897db2d5ab9fc5afbcd2456f9 Mon Sep 17 00:00:00 2001 From: Joe Huss Date: Thu, 13 Aug 2026 21:40:33 -0400 Subject: [PATCH 2/2] deps: take xml_rpc2 from our fork, which carries the PHP 8.2 fix pear/xml_rpc2 1.1.5 emits 'Using ${var} in strings is deprecated' from Xmlrpcext/Client.php:129. This repo's phpunit config turns warnings into failures, so the suite could not go green while that release stood -- and the deprecation is real, not cosmetic: PHP 9 removes the syntax outright. Upstream FIXED it in 862987e (2025-03-05) and then never released it: the last tag is 1.1.5 from 2022, and pear/XML_RPC2 is now an ARCHIVED repository, so there will not be a 1.1.6 from them. Forked to myadmin-plugins/XML_RPC2 and tagged 1.1.6 at upstream trunk. The fork carries no patch of ours -- it is upstream's own fix, released. The package name is unchanged (pear/xml_rpc2), so this is a repositories entry rather than a rename, and dropping that entry reverts to packagist cleanly if upstream revives. composer.lock is gitignored in this repo, so only the manifest is committed. Suite goes from 2 errors to green: 88 tests, 0 failures. Co-Authored-By: Claude Opus 5 (1M context) --- composer.json | 92 +++++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/composer.json b/composer.json index 39a980a..a7dfe9c 100644 --- a/composer.json +++ b/composer.json @@ -1,45 +1,51 @@ { - "name": "detain/myadmin-cloudlinux-licensing", - "type": "myadmin-plugin", - "description": "Cloudlinux Licensing Class", - "keywords": [ - "cloudlinux", - "administration", - "license" - ], - "license": "LGPL-2.1-only", - "authors": [ - { - "name": "Joe Huss", - "homepage": "https:\/\/my.interserver.net\/" - } - ], - "config": { - "bin-dir": "vendor\/bin", - "minimum-stability": "dev", - "allow-plugins": { - "detain/myadmin-plugin-installer": true - } - }, - "require": { - "php": ">=5.3.0", - "pear/xml_rpc2": "*", - "ext-curl": "*", - "symfony/event-dispatcher": "*@stable", - "detain/myadmin-plugin-installer": "^2.1", - "detain/cloudlinux-licensing": "dev-master" - }, - "require-dev": { - "phpunit/phpunit": "^9.6" - }, - "autoload": { - "psr-4": { - "Detain\\MyAdminCloudlinux\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Detain\\MyAdminCloudlinux\\Tests\\": "tests/" - } - } + "name": "detain/myadmin-cloudlinux-licensing", + "type": "myadmin-plugin", + "description": "Cloudlinux Licensing Class", + "keywords": [ + "cloudlinux", + "administration", + "license" + ], + "license": "LGPL-2.1-only", + "authors": [ + { + "name": "Joe Huss", + "homepage": "https://my.interserver.net/" + } + ], + "config": { + "bin-dir": "vendor/bin", + "minimum-stability": "dev", + "allow-plugins": { + "detain/myadmin-plugin-installer": true + } + }, + "require": { + "php": ">=5.3.0", + "pear/xml_rpc2": "^1.1.6", + "ext-curl": "*", + "symfony/event-dispatcher": "*@stable", + "detain/myadmin-plugin-installer": "^2.1", + "detain/cloudlinux-licensing": "dev-master" + }, + "require-dev": { + "phpunit/phpunit": "^9.6" + }, + "autoload": { + "psr-4": { + "Detain\\MyAdminCloudlinux\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Detain\\MyAdminCloudlinux\\Tests\\": "tests/" + } + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/myadmin-plugins/XML_RPC2.git" + } + ] }