function charts_highcharts_requirements in Charts 5.0.x
Same name and namespace in other branches
- 8.4 modules/charts_highcharts/charts_highcharts.install \charts_highcharts_requirements()
- 8 modules/charts_highcharts/charts_highcharts.install \charts_highcharts_requirements()
- 8.3 modules/charts_highcharts/charts_highcharts.install \charts_highcharts_requirements()
- 7.2 modules/charts_highcharts/charts_highcharts.install \charts_highcharts_requirements()
Implements hook_requirements().
File
- modules/
charts_highcharts/ charts_highcharts.install, line 13 - Installation and update hooks for the Charts Highcharts module.
Code
function charts_highcharts_requirements($phase) {
$requirements = [];
switch ($phase) {
case 'runtime':
$library_path = charts_highcharts_find_library();
if (!$library_path) {
$requirements['charts_highcharts_js'] = [
'title' => t('Highcharts Library'),
'value' => t('Not Installed'),
'severity' => REQUIREMENT_ERROR,
'description' => t('You are missing the Highcharts library in your Drupal installation directory. Please see the README file inside charts_highcharts for instructions to install the library.'),
];
}
else {
$requirements['charts_highcharts_js'] = [
'title' => t('Highcharts Library'),
'severity' => REQUIREMENT_OK,
'value' => t('Installed'),
];
}
break;
}
if (function_exists('libraries_detect') && ($highcharts_info = libraries_detect('highcharts'))) {
if (is_dir($highcharts_info['library path'] . '/js/exporting-server')) {
$requirements['highcharts_security'] = [
'title' => t('Highcharts vulnerability'),
'severity' => REQUIREMENT_ERROR,
'value' => t('Dangerous sample code present'),
'description' => t('Your installation of the Highcharts library at "@path" contains a directory named "exporting-server". This directory contains dangerous sample files that may compromise the security of your site. You must delete this directory before you may use the Charts Highcharts module.', [
'@path' => $highcharts_info['library path'],
]),
];
}
}
return $requirements;
}