You are here

public function QueuersService::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 QueuersService::reload()
QueuersService::setPluginsEnabled in src/Plugin/Purge/Queuer/QueuersService.php
Set the plugins used by the service and reload it.

File

src/Plugin/Purge/Queuer/QueuersService.php, line 97

Class

QueuersService
Provides a service that provides access to loaded queuers.

Namespace

Drupal\purge\Plugin\Purge\Queuer

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();
}