You are here

function feeds_excel_requirements in Feeds Excel 7

Same name and namespace in other branches
  1. 6 feeds_excel.install \feeds_excel_requirements()
  2. 7.2 feeds_excel.install \feeds_excel_requirements()

Implements hook_requirements().

File

./feeds_excel.install, line 6

Code

function feeds_excel_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time
  $t = get_t();
  if (!module_exists('libraries')) {
    $requirements['feeds_excel:libraries'] = array(
      'title' => $t('Feeds Excel'),
      'description' => $t('The Libraries API module is not enabled. Please make sure it is downloaded (from http://drupal.org/project/libraries) and enabled.'),
      'severity' => REQUIREMENT_ERROR,
    );
  }
  if (module_exists('libraries')) {
    $path = libraries_get_path('phpExcelReader');
    if (empty($path)) {
      $requirements['feeds_excel:libraries'] = array(
        'title' => $t('phpExcelReader'),
        'description' => $t('The phpExcelReader library is not present. It should be placed in a path supported by libraries API (e.g. sites/all/libraries/phpExcelReader)! You can download it from @link. For more information look in Feeds Excel\'s README.txt.', array(
          '%path' => $path,
          '@link' => 'https://github.com/derhasi/phpExcelReader/zipball/interim2',
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }
    elseif (!file_exists($path . '/Excel/reader.php')) {
      $reader_path = $path . '/Excel/reader.php';
      $requirements['feeds_excel:libraries'] = array(
        'title' => $t('phpExcelReader'),
        'description' => $t('The phpExcelReader library\'s reader.php is not located at the correct spot. It should be placed at @path. For more information look in Feeds Excel\'s README.txt.', array(
          '@path' => $reader_path,
          '@link' => 'https://github.com/derhasi/phpExcelReader/zipball/interim2',
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}