You are here

function piwik_update_7203 in Piwik Web Analytics 6.2

Same name and namespace in other branches
  1. 7.2 piwik.install \piwik_update_7203()

Path visibility filter setting should hide "batch" path.

File

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

Code

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

  // Current pages setting.
  $pages = array(
    'admin',
    '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 previous settings found. Update with new settings.
    $pages = array(
      'admin',
      'admin/*',
      'batch',
      'node/add*',
      'node/*/*',
      'user/*/*',
    );
    variable_set('piwik_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;
}