You are here

function googleanalytics_update_7000 in Google Analytics 7.2

Same name and namespace in other branches
  1. 7 googleanalytics.install \googleanalytics_update_7000()

Run D6 -> D7 upgrades.

File

./googleanalytics.install, line 315
Installation file for Google Analytics module.

Code

function googleanalytics_update_7000() {

  // Update JavaScript scope to 'header'.
  variable_set('googleanalytics_js_scope', 'header');
  $messages[] = t('Google tracking code has been moved to header.');

  // Upgrade D6 token placeholder to D7. update_6301 is not required.
  $googleanalytics_custom_vars = variable_get('googleanalytics_custom_var', array());
  if (!empty($googleanalytics_custom_vars['slots'][1]) && $googleanalytics_custom_vars['slots'][1]['name'] == 'User roles' && ($googleanalytics_custom_vars['slots'][1]['value'] = '[user-role-names]')) {
    $googleanalytics_custom_vars['slots'][1]['value'] = '[current-user:role-names]';
    variable_set('googleanalytics_custom_var', $googleanalytics_custom_vars);
    $messages[] = t("The D6 token placeholder [user-role-names] used in the custom variable 'User roles' has been replaced with [current-user:role-names].");
  }
  return implode(' ', $messages);
}