You are here

function purge_proxy_config_convert in Purge 7.2

Function to convert Purge 1.x proxy configurations.

File

./purge.install, line 43
Purge install code. Installs and uninstalls the configuration variables and converts from 1.x settings

Code

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
  }
}