You are here

function charts_highcharts_requirements in Charts 8.4

Same name and namespace in other branches
  1. 8 modules/charts_highcharts/charts_highcharts.install \charts_highcharts_requirements()
  2. 8.3 modules/charts_highcharts/charts_highcharts.install \charts_highcharts_requirements()
  3. 7.2 modules/charts_highcharts/charts_highcharts.install \charts_highcharts_requirements()
  4. 5.0.x 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 = [];
  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;
}