You are here

function piwik_requirements in Piwik Web Analytics 7

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

Implementation of hook_requirements().

File

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

Code

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

      // Module cannot validate piwik URL without external HTTP requests.
      if (variable_get('drupal_http_request_fails', TRUE) && !system_check_http_request()) {
        $requirements['http requests'] = array(
          'title' => $t('HTTP request status'),
          'value' => $t('Fails'),
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality. This could be due to your webserver configuration or PHP settings, and should be resolved in order to download information about available updates, fetch aggregator feeds, sign in via OpenID, or use other network-dependent services.'),
        );
      }

      // 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/config/system/piwik'),
          )),
          'severity' => REQUIREMENT_ERROR,
          'value' => $t('Not configured'),
        );
      }
      break;
  }
  return $requirements;
}