You are here

function statcounter_requirements in StatCounter 7.2

Implements hook_requirements().

File

./statcounter.install, line 48
Installation file for Statcounter - Web analytics module.

Code

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

      // Module cannot validate statcounter 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 Statcounter user account has not been set yet.
      if (!preg_match('/^\\d{1,}$/', variable_get('statcounter_project_id', ''))) {
        $requirements['statcounter'] = array(
          'title' => $t('Statcounter module'),
          'description' => $t('Statcounter module has not been configured yet. Please configure its settings from the <a href="@url">Statcounter settings page</a>.', array(
            '@url' => url('admin/config/system/statcounter'),
          )),
          'severity' => REQUIREMENT_ERROR,
          'value' => $t('Not configured'),
        );
      }
      break;
  }
  return $requirements;
}