function matomo_requirements in Matomo Analytics 7.2
Same name and namespace in other branches
- 8 matomo.install \matomo_requirements()
Implementation of hook_requirements().
File
- ./
matomo.install, line 71 - Installation file for Matomo Analytics module.
Code
function matomo_requirements($phase) {
$requirements = array();
$t = get_t();
switch ($phase) {
case 'runtime':
// Module cannot validate matomo URL without external HTTP requests.
if (variable_get('drupal_http_request_fails', TRUE) && !system_check_http_request()) {
$requirements['matomo_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 Matomo user account has not been set yet.
if (!preg_match('/^\\d{1,}$/', variable_get('matomo_site_id', ''))) {
$requirements['matomo'] = array(
'title' => $t('Matomo module'),
'description' => $t('Matomo module has not been configured yet. Please configure its settings from the <a href="@url">Matomo settings page</a>.', array(
'@url' => url('admin/config/system/matomo'),
)),
'severity' => REQUIREMENT_WARNING,
'value' => $t('Not configured'),
);
}
break;
}
return $requirements;
}