Skip to content
Snippets Groups Projects
Commit 85932447 authored by Bruno Massa's avatar Bruno Massa
Browse files

Improvements:

* A warning on hook_requirements when the PHP version is below 5.2
parent 3564e100
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@
* Install and unistall functions for this module
*/
DEFINE(CHARTS_MINIMUM_PHP, '5.2.0');
/**
* Implementation of hook_uninstall().
*/
......@@ -17,20 +19,29 @@ function charts_uninstall() {
* Implementation of hook_requirements().
*/
function charts_requirements($phase) {
// Test PHP version
if (version_compare(phpversion(), CHARTS_MINIMUM_PHP) < 0) {
$requirements['charts_php']['title'] = t('PHP Charts');
$requirements['charts_php']['value'] = ($phase == 'runtime') ? l(phpversion(), 'admin/logs/status/php') : phpversion();
$requirements['charts_php']['description'] = t('Your PHP installation is too old. Charts requires at least PHP %version.',
array('%version' => CHARTS_MINIMUM_PHP));
$requirements['charts_php']['severity'] = REQUIREMENT_ERROR;
}
if ($phase == 'runtime' and !$modules = module_invoke_all('charts_info', 'list')) {
$requirements['charts']['title'] = t('Charts');
$requirements['charts']['value'] = t('No Charts provider installed');
$requirements['charts']['severity'] = REQUIREMENT_ERROR;
$requirements['charts']['description'] = t('Charts core module only provides a a common set of functions. You must install a Charts provider module to create charts.');
return $requirements;
}
elseif ($phase == 'runtime' and !$settings = variable_get('charts_settings', array())) {
$requirements['charts']['title'] = t('Charts');
$requirements['charts']['value'] = t('Charts module not yet configured');
$requirements['charts']['severity'] = REQUIREMENT_ERROR;
$requirements['charts']['description'] = t('Charts core module needs to get some default options in order to operate. You must go to <a href="!link">settings page</a> and configure it.', array('!link' => url('admin/settings/charts')));
}
if (isset($requirements)) {
return $requirements;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment