You are here

protected function AcquiaPlatformCdnPurger::initializeBackend in Acquia Purge 8

Lazy load the underlying backend based on PlatformInfo CDN configuration.

@warning Don't call this from the constructor!

3 calls to AcquiaPlatformCdnPurger::initializeBackend()
AcquiaPlatformCdnPurger::invalidateEverything in src/Plugin/Purge/Purger/AcquiaPlatformCdnPurger.php
Invalidate the entire CDN.
AcquiaPlatformCdnPurger::invalidateTags in src/Plugin/Purge/Purger/AcquiaPlatformCdnPurger.php
Invalidate a set of tag invalidations.
AcquiaPlatformCdnPurger::invalidateUrls in src/Plugin/Purge/Purger/AcquiaPlatformCdnPurger.php
Invalidate a set of URL invalidations.

File

src/Plugin/Purge/Purger/AcquiaPlatformCdnPurger.php, line 95

Class

AcquiaPlatformCdnPurger
Acquia Platform CDN (beta).

Namespace

Drupal\acquia_purge\Plugin\Purge\Purger

Code

protected function initializeBackend() {
  if (!is_null($this->backend)) {
    return;
  }
  $this
    ->debugger()
    ->callerAdd(__METHOD__);

  // Attempt to load the backend or halt code execution.
  $this->backend = BackendFactory::get($this->platformInfo, $this
    ->logger(), $this
    ->debugger(), $this->httpClient);
  if (!$this->backend) {
    throw new \RuntimeException("AcquiaPlatformCdnPurger has no backend!");
  }

  // Instantiate the backend and inject the logger.
  $this
    ->debugger()
    ->callerAdd($this->backend);
}