From cd4facf1175bf547900b339efaa8cc45debd42d7 Mon Sep 17 00:00:00 2001 From: WordPressFan Date: Wed, 17 Apr 2024 11:20:11 +0200 Subject: [PATCH] fix container fatal errors with activation and deactivation --- inc/Engine/Activation/Activation.php | 12 +++++++----- inc/Engine/Deactivation/Deactivation.php | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/inc/Engine/Activation/Activation.php b/inc/Engine/Activation/Activation.php index 10edbe2b2c..f40133eddd 100644 --- a/inc/Engine/Activation/Activation.php +++ b/inc/Engine/Activation/Activation.php @@ -4,8 +4,10 @@ use WP_Rocket\Admin\Options; use WP_Rocket\Dependencies\League\Container\Container; -use WP_Rocket\Event_Management\Event_Manager; +use WP_Rocket\ServiceProvider\Options as OptionsServiceProvider; +use WP_Rocket\Engine\Preload\Activation\ServiceProvider as PreloadActivationServiceProvider; use WP_Rocket\ThirdParty\Hostings\HostResolver; +use WP_Rocket\ThirdParty\Hostings\ServiceProvider as HostingsServiceProvider; /** * Plugin activation controller @@ -37,10 +39,10 @@ public static function activate_plugin() { $container->add( 'template_path', WP_ROCKET_PATH . 'views' ); $options_api = new Options( 'wp_rocket_' ); $container->add( 'options_api', $options_api ); - $container->addServiceProvider( \WP_Rocket\ServiceProvider\Options::class ); - $container->addServiceProvider( \WP_Rocket\Engine\Preload\Activation\ServiceProvider::class ); - $container->addServiceProvider( ServiceProvider::class ); - $container->addServiceProvider( \WP_Rocket\ThirdParty\Hostings\ServiceProvider::class ); + $container->addServiceProvider( new OptionsServiceProvider() ); + $container->addServiceProvider( new PreloadActivationServiceProvider() ); + $container->addServiceProvider( new ServiceProvider() ); + $container->addServiceProvider( new HostingsServiceProvider() ); $host_type = HostResolver::get_host_service(); diff --git a/inc/Engine/Deactivation/Deactivation.php b/inc/Engine/Deactivation/Deactivation.php index 3504e1de76..e93e9a238a 100644 --- a/inc/Engine/Deactivation/Deactivation.php +++ b/inc/Engine/Deactivation/Deactivation.php @@ -8,6 +8,7 @@ use WP_Rocket\Engine\Support\ServiceProvider as SupportServiceProvider; use WP_Rocket\ServiceProvider\Options as OptionsServiceProvider; use WP_Rocket\ThirdParty\Hostings\HostResolver; +use WP_Rocket\ThirdParty\Hostings\ServiceProvider as HostingsServiceProvider; class Deactivation { /** @@ -35,12 +36,12 @@ public static function deactivate_plugin() { $container->add( 'options_api', new Options( 'wp_rocket_' ) ); $container->add( 'template_path', WP_ROCKET_PATH . 'views' ); - $container->addServiceProvider( OptionsServiceProvider::class ); - $container->addServiceProvider( BeaconServiceProvider::class ); - $container->addServiceProvider( SupportServiceProvider::class ); + $container->addServiceProvider( new OptionsServiceProvider() ); + $container->addServiceProvider( new BeaconServiceProvider() ); + $container->addServiceProvider( new SupportServiceProvider() ); - $container->addServiceProvider( 'WP_Rocket\Engine\Deactivation\ServiceProvider' ); - $container->addServiceProvider( 'WP_Rocket\ThirdParty\Hostings\ServiceProvider' ); + $container->addServiceProvider( new ServiceProvider() ); + $container->addServiceProvider( new HostingsServiceProvider() ); $host_type = HostResolver::get_host_service();