function ga_stats_requirements in Google Analytics Statistics 7
Same name and namespace in other branches
- 7.2 ga_stats.install \ga_stats_requirements()
Implements hook_requirements().
File
- ./
ga_stats.install, line 6
Code
function ga_stats_requirements($phase) {
if ($phase != 'runtime') {
return array();
}
$t = get_t();
$requirements = array();
$requirements['ga_stats_ready'] = array(
'title' => $t('GA Stats Connection'),
);
if (!ga_stats_is_ready()) {
$requirements['ga_stats_ready'] += array(
'value' => l($t('Not Configured'), 'admin/config/services/ga_stats'),
'description' => $t('The GA Stats module is not configured for use. Any dependent functionality is broken.'),
'severity' => REQUIREMENT_ERROR,
);
}
elseif (!ga_stats_can_authenticate()) {
$requirements['ga_stats_ready'] += array(
'value' => l($t('Invalid Credentials'), 'admin/config/services/ga_stats'),
'description' => $t('GA Stats credentials are invalid. Please update on the configuration page. Any dependent functionality is broken.'),
'severity' => REQUIREMENT_ERROR,
);
}
else {
$requirements['ga_stats_ready'] += array(
'value' => $t('Connected'),
'severity' => REQUIREMENT_OK,
);
}
// Currently hardcoded in client-library path.
$requirements['ga_stats_api_version'] = array(
'title' => $t('GA Stats API Version Compatibility'),
'value' => 'v2.4',
'severity' => REQUIREMENT_INFO,
'description' => $t('The next scheduled update is set for !date', array(
'!date' => date('r', ga_stats_data_expiration_date()),
)),
);
if (!variable_get('ga_stats_last_update', FALSE)) {
$requirements['ga_stats_api_version']['severity'] = REQUIREMENT_WARNING;
$requirements['ga_stats_api_version']['description'] = $t('Google Analytics data has not been accessed yet. Please run cron or visit the !configuration page to update counts.', array(
'!configuration' => l($t('configuration'), 'admin/config/services/ga_stats'),
));
}
return $requirements;
}