app->singleton(ProviderRegistry::class); $this->app->singleton(ConnectionStatusStore::class); $this->app->singleton(ConnectionTester::class); $this->app->singleton(CloudProviderFactory::class); $this->app->alias(CloudProviderFactory::class, 'cloud_provider_factory'); // The provider picked in settings, or null while none is configured or the saved one cannot be loaded // (an add-on that added it was removed, or the option is damaged). The site must keep loading either way. $this->app->singleton(S3_Provider::class, function (Container $app) { $key = advmo_get_cloud_provider_key(); if ($key === '') { return null; } try { return $app->get(ProviderRegistry::class)->make($key); } catch (Exception $e) { return null; } }); $this->app->alias(S3_Provider::class, 'cloud_provider'); } public function boot(): void { if (is_admin() && advmo_get_cloud_provider_key() !== '' && $this->app->get(S3_Provider::class) === null) { add_action('admin_notices', [$this, 'unavailableProviderNotice']); } } public function unavailableProviderNotice(): void { if (!current_user_can('manage_options')) { return; } printf( '
%s %s