You are here

function barcode_requirements in Barcode 6

Same name and namespace in other branches
  1. 6.2 barcode.install \barcode_requirements()
  2. 7.2 barcode.install \barcode_requirements()

Implementation of hook_requirements().

File

./barcode.install, line 43
Implementation of hook_install().

Code

function barcode_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {

    // File paths
    $barcode_path = file_create_path(rtrim(variable_get('barcode_default_path', 'barcodes')));
    if (!file_check_directory($barcode_path, FILE_CREATE_DIRECTORY)) {
      $requirements['barcode_dirs'] = array(
        'value' => t('Missing directory'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t("The barcode module's barcode directory %barcode-dir is missing.", array(
          '%barcode-dir' => $barcode_path,
        )),
      );
    }
    else {
      $requirements['barcode_dirs'] = array(
        'value' => t('Exists (%path)', array(
          '%path' => $barcode_path,
        )),
        'severity' => REQUIREMENT_OK,
      );
    }
    $requirements['barcode_dirs']['title'] = t('Barcode module directories');
  }
  return $requirements;
}