Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix container fatal errors with activation and deactivation #6567

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions inc/Engine/Activation/Activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down
11 changes: 6 additions & 5 deletions inc/Engine/Deactivation/Deactivation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down Expand Up @@ -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();

Expand Down
Loading