You are here

public function ProcessorsService::reload in Purge 8.3

Reload the service and reinstantiate all enabled plugins.

@warning Reloading a service implies that all cached data will be reset and that plugins get reinstantiated during the current request, which should normally not be used. This method is specifically used in tests.

Overrides ServiceBase::reload

1 call to ProcessorsService::reload()
ProcessorsService::setPluginsEnabled in src/Plugin/Purge/Processor/ProcessorsService.php
Set the plugins used by the service and reload it.

File

src/Plugin/Purge/Processor/ProcessorsService.php, line 97

Class

ProcessorsService
Provides a service that provides access to loaded processors.

Namespace

Drupal\purge\Plugin\Purge\Processor

Code

public function reload() {
  parent::reload();

  // Without this, the tests will throw "failed to instantiate user-supplied
  // statement class: CREATE TABLE {cache_config}".
  // phpcs:ignore DrupalPractice.Objects.GlobalDrupal.GlobalDrupal
  $this->configFactory = \Drupal::configFactory();

  // Drush commands appreciate it when the config cache gets cleared.
  if (php_sapi_name() === 'cli') {

    // phpcs:ignore DrupalPractice.Objects.GlobalDrupal.GlobalDrupal
    \Drupal::cache('config')
      ->deleteAll();
  }
  $this
    ->reloadIterator();
}