function statspro_requirements in Statistics Pro 6.2
Same name and namespace in other branches
- 6 statspro.install \statspro_requirements()
Implementation of hook_requirements().
File
- ./
statspro.install, line 96 - 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_cron'] = 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 indicates that the Aggegate Statistics module should be
* removed.
*/
if (module_exists('aggregate_statistics')) {
$requirements['statspro_aggregate_statistics'] = array(
'title' => $t('@module module', array(
'@module' => $t('Aggregate Statistics'),
)),
'value' => $t('Enabled'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('The @aggregate_statistics_module module should be uninstalled as the @this_module module implements all @aggregate_statistics_module module features since version 6.x-2.x', array(
'@aggregate_statistics_module' => $t('Aggregate Statistics'),
'@this_module' => $t('Statistics Pro'),
)),
);
}
/**
* Only show recommended modules if the optional dependencies are met.
*/
if (module_exists('statistics') && variable_get('statistics_enable_access_log', 0) != 0) {
if (!module_exists('statistics_advanced')) {
// Statistics Advanced module is recommended.
$requirements['statspro_statistics_advanced'] = array(
'title' => $t('@module module', array(
'@module' => $t('Statistics Advanced'),
)),
'value' => $t('Disabled'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('The !statistics_advanced_module module is recommended as it fixes core
%statistics_module module bugs. Please consider installing and enabling it.', array(
'!statistics_advanced_module' => l(t('Statistics Advanced'), 'http://drupal.org/project/statistics_advanced'),
'%statistics_module' => t('Statistics'),
)),
);
}
if (!module_exists('browscap')) {
$requirements['statspro_browscap'] = array(
'title' => $t('@module module', array(
'@module' => $t('Browscap'),
)),
'value' => $t('Disabled'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('The !browscap_module module is recommended as with it the
%statistics_advanced_module module can separate regular traffic from webcrawler
traffic. Please consider installing and enabling it.', array(
'!browscap_module' => l(t('Browscap'), 'http://drupal.org/project/browscap'),
'%statistics_advanced_module' => t('Statistics Advanced'),
)),
);
}
}
}
return $requirements;
}