You are here

function piwik_requirements in Piwik Web Analytics 5

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

Implementation of hook_requirements().

File

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

Code

function piwik_requirements($phase) {
  $requirements = array();
  $t = get_t();
  switch ($phase) {
    case 'runtime':

      // Raise warning if Piwik user account has not been set yet.
      if (!preg_match('/^\\d{1,}$/', variable_get('piwik_site_id', ''))) {
        $requirements['piwik'] = array(
          'title' => $t('Piwik module'),
          'description' => $t('Piwik module has not been configured yet. Please configure its settings from the <a href="@url">Piwik settings page</a>.', array(
            '@url' => url('admin/settings/piwik'),
          )),
          'severity' => REQUIREMENT_ERROR,
          'value' => $t('Not configured'),
        );
      }
      break;
  }
  return $requirements;
}