You are here

function advagg_update_7217 in Advanced CSS/JS Aggregation 7.2

Update migrate the advagg_browser_dns_prefetch variable.

File

./advagg.install, line 753
Handles Advanced Aggregation installation and upgrade tasks.

Code

function advagg_update_7217(&$sandbox) {
  $advagg_browser_dns_prefetch = variable_get('advagg_browser_dns_prefetch', NULL);
  $advagg_resource_hints_dns_prefetch = variable_get('advagg_resource_hints_dns_prefetch', NULL);
  $advagg_resource_hints_location = variable_get('advagg_resource_hints_location', NULL);
  variable_del('advagg_browser_dns_prefetch');
  if (empty($advagg_browser_dns_prefetch) || !is_null($advagg_resource_hints_dns_prefetch) || !is_null($advagg_resource_hints_location)) {
    return t('Nothing needed to be done.');
  }
  drupal_load('module', 'advagg');
  $config_path = advagg_admin_config_root_path();
  if ($advagg_browser_dns_prefetch == 1) {
    variable_set('advagg_resource_hints_location', 1);
    variable_set('advagg_resource_hints_dns_prefetch', TRUE);
  }
  elseif ($advagg_browser_dns_prefetch == 2) {
    variable_set('advagg_resource_hints_location', 3);
    variable_set('advagg_resource_hints_dns_prefetch', TRUE);
  }
  else {
    return t('Nothing happened.');
  }
  return t('Old DNS Prefetch variable transferred to the new variable. Other options are under Resource Hints on the <a href="@url">configuration page</a>', array(
    '@url' => url($config_path . '/advagg', array(
      'fragment' => 'edit-resource-hints',
    )),
  ));
}