function statspro_requirements in Statistics Pro 6
Same name and namespace in other branches
- 6.2 statspro.install \statspro_requirements()
Implementation of hook_requirements().
File
- ./
statspro.install, line 68 - Install file for statistics pro module
Code
function statspro_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
if ($phase == 'runtime') {
$last_run = variable_get('statspro_last_run', 0);
if (empty($last_run)) {
$requirements['statspro'] = array(
'title' => $t('Statistics Pro'),
'description' => $t('Statistics Pro requires to run cron. !url', array(
'!url' => l('You can run cron manually.', 'admin/reports/status/run-cron'),
)),
'severity' => REQUIREMENT_ERROR,
'value' => $t('No data generated'),
);
}
/**
* This check is important to catch updates from previous versions when the
* Statistics Advanced module wasn't yet a dependency.
*/
$req_id = 'statspro_statistics_advanced';
$requirements[$req_id] = array(
'title' => $t('@module module', array(
'@module' => $t('Statistics Advanced'),
)),
);
if (module_exists('statistics_advanced')) {
$requirements[$req_id]['value'] = $t('Enabled');
$requirements[$req_id]['severity'] = REQUIREMENT_OK;
}
else {
$requirements[$req_id]['value'] = $t('Disabled');
$requirements[$req_id]['severity'] = REQUIREMENT_WARNING;
$requirements[$req_id]['description'] = $t('All users of @this_module module should enable the !statistics_advanced module for proper statistcs recording. Please consider installing and enabling it.', array(
'!statistics_advanced' => l($t('Statistics Advanced'), 'http://drupal.org/project/statistics_advanced'),
'@this_module' => $t('Statistics Pro'),
));
}
}
return $requirements;
}