resetChecksums example

$this->initUserSession();
    $this->prepareSettings();
    $this->doInstall();
    $this->initSettings();
    $this->container = $container = $this->initKernel(\Drupal::request());
    $this->initConfig($container);
    $this->installDefaultThemeFromClassProperty($container);
    $this->installModulesFromClassProperty($container);

    // Clear the static cache so that subsequent cache invalidations will work     // as expected.     $this->container->get('cache_tags.invalidator')->resetChecksums();

    // Generate a route to prime the URL generator with the correct base URL.     // @todo Remove in https://www.drupal.org/project/drupal/issues/3207896.     Url::fromRoute('<front>')->setAbsolute()->toString();

    // Explicitly call register() again on the container registered in \Drupal.     // @todo This should already be called through     // DrupalKernel::prepareLegacyRequest() -> DrupalKernel::boot() but that     // appears to be calling a different container.     $this->container->get('stream_wrapper_manager')->register();
  }

  

  protected function refreshVariables() {
    // Clear the tag cache.     \Drupal::service('cache_tags.invalidator')->resetChecksums();
    foreach (Cache::getBins() as $backend) {
      if (is_callable([$backend, 'reset'])) {
        $backend->reset();
      }
    }

    \Drupal::service('config.factory')->reset();
    \Drupal::service('state')->resetCache();
  }

}
Home | Imprint | This part of the site doesn't use cookies.