You are here

function piwik_update_6000 in Piwik Web Analytics 6

Same name and namespace in other branches
  1. 5 piwik.install \piwik_update_6000()
  2. 6.2 piwik.install \piwik_update_6000()
  3. 7.2 piwik.install \piwik_update_6000()
  4. 7 piwik.install \piwik_update_6000()

Change visibility setting for paths.

File

./piwik.install, line 84
Installation file for Piwik - Web analytics module.

Code

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

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

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