You are here

function googleanalytics_update_6302 in Google Analytics 6.4

Same name and namespace in other branches
  1. 6.3 googleanalytics.install \googleanalytics_update_6302()

Path visibility filter setting should hide "batch" path.

File

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

Code

function googleanalytics_update_6302() {
  $ret = array();

  // Current pages setting.
  $pages = array(
    'admin',
    'admin/*',
    'user/*/*',
    'node/add*',
    'node/*/*',
  );
  $diff = array_diff($pages, preg_split('/(\\r\\n?|\\n)/', variable_get('googleanalytics_pages', implode("\n", $pages))));
  if (empty($diff)) {

    // No diff to previous settings found. Update with new settings.
    $pages = array(
      'admin',
      'admin/*',
      'batch',
      'node/add*',
      'node/*/*',
      'user/*/*',
    );
    variable_set('googleanalytics_pages', implode("\n", $pages));
    $ret[] = array(
      'success' => TRUE,
      'query' => 'Added "batch" to path visibility filter setting.',
    );
  }
  else {
    $ret[] = array(
      'success' => TRUE,
      'query' => 'Custom path visibility filter setting found. Update skipped!',
    );
  }
  return $ret;
}