You are here

public function PurgePurgerBundleExample::__construct in Purge 7.2

Constructor.

File

includes/defaults.inc, line 241
Provides default configuration and handlers or the Purge module.

Class

PurgePurgerBundleExample
Class definition for the Example Bundle. Provides a set of examples for various uses.

Code

public function __construct() {

  // Targets
  // The localhost target
  $this->target['localhost'] = new PurgeTargetStatic();
  $this->target['localhost']->name = t('Localhost');
  $this->target['localhost']->description = t('The default localhost ip address.');
  $this->target['localhost']->access = array(
    PURGE_ACCESS_FULL,
  );
  $this->target['localhost']->urls = array(
    'http://127.0.0.1',
  );

  // Domains
  // Get the current domain from the domain object.
  $item_domain_drupal = new PurgeDomainDrupal();
  $item_domain_drupal
    ->cache();
  $this->domain['current_domain'] = new PurgeDomainStatic();
  $this->domain['current_domain']->name = t('Current Domain');
  $this->domain['current_domain']->description = t('Use the current domain as an example domain.');
  $this->domain['current_domain']->domains = $item_domain_drupal->domains[0];

  // Headers
  // Purgers
  // Now create the purger objects
  $this->purger['minimal_purger'] = new PurgePurgerUrl();
  $this->purger['minimal_purger']->name = t('Minimal Purger');
  $this->purger['minimal_purger']->description = t('Uses Drupal native methods to issue the requests.');
  $this->purger['minimal_purger']->item = array(
    'option' => array(
      'method' => 'PURGE',
    ),
    'depend' => array(),
    'target' => array(
      'drupal_url',
    ),
    'header' => array(
      'gzip',
    ),
    'queue' => array(
      'fake',
    ),
    'handler' => array(
      'drupal_http_request',
    ),
  );
  $this->purger['default_purger'] = new PurgePurgerUrl();
  $this->purger['default_purger']->name = t('Default Purger');
  $this->purger['default_purger']->description = t('Uses common settings used for a Varnish setup.');
  $this->purger['default_purger']->item = array(
    'option' => array(
      'method' => 'PURGE',
      'parallel' => 1,
    ),
    'depend' => array(),
    'target' => array(
      'drupal_url',
      'localhost',
    ),
    'domain' => array(
      'drupal_domain',
    ),
    'header' => array(
      'gzip',
    ),
    'queue' => array(
      'fake',
    ),
    'handler' => array(
      'curl',
    ),
  );
}