You are here

purge.install in Purge 7.2

Same filename and directory in other branches
  1. 8.3 purge.install
  2. 6 purge.install
  3. 7 purge.install

Purge install code. Installs and uninstalls the configuration variables and converts from 1.x settings

File

purge.install
View source
<?php

/**
 * @file
 * Purge install code.
 *   Installs and uninstalls the configuration variables
 *   and converts from 1.x settings
 */

// Load the purge_admin.inc file
module_load_include('inc', 'purge', 'includes/purge');
module_load_include('inc', 'purge', 'includes/defaults');

/**
 * Implements hook_install().
 */
function purge_install() {

  // Add the default  configurations
  $bundle = new PurgePurgerBundleDefault();

  // Reconfigure to load Depend and API bundles.
  // $bundle->configure();
  $bundle
    ->save();
}

/**
 * Implements hook_update_N().
 */
function purge_update_7200() {

  //Add the system and template proxy configurations
  $bundle = new PurgePurgerBundleDefault();

  // purge_proxy_config_convert();
  // Save the bundle.
  $bundle
    ->save();
}

/**
 * Function to convert Purge 1.x  proxy configurations.
 */
function purge_proxy_config_convert() {

  // Get the 1.x configuration
  $proxy_urls = explode(' ', variable_get('purge_proxy_urls', 'http://localhost:80'));
  $proxy_url_parts = array();
  $proxy_ah_domains = array();

  // parse each url
  foreach ($proxy_urls as $proxy_url) {
    $proxy_url_parts[] = parse_url($proxy_url);

    // Check for Acquia method
    if (strstr($proxy_url_parts['query'], 'purge_method=ah')) {
      $proxy_ah_domains[] = $proxy_url_parts['host'];
    }
    else {

      // Check for https
      if ($proxy_url_parts['scheme'] == 'https') {
        $proxy_ssl = TRUE;
      }
      else {
        $proxy_ssl = FALSE;
      }

      // Check for the get method
      if (strstr($proxy_url_parts['query'], 'purge_method=get')) {
        $purge_method = 'GET';
      }
      else {
        $purge_method = 'PURGE';
      }

      // Insert the proxy configuration into the database
    }
  }

  // Process all Acquia domains as one configuration
  if (count($proxy_ah_domains) > 0) {

    // Insert the proxy configuration into the database
  }
}

/**
 * Implements hook_uninstall().
 */
function purge_uninstall() {

  // Clean up the settings variable
  variable_del('purge_config');
}

Functions

Namesort descending Description
purge_install Implements hook_install().
purge_proxy_config_convert Function to convert Purge 1.x proxy configurations.
purge_uninstall Implements hook_uninstall().
purge_update_7200 Implements hook_update_N().