<?php

/**
 * @file
 * Install, update and uninstall functions for the file_upload_secure_validator module.
 */

/**
 * Implements hook_requirements.
 */
function file_upload_secure_validator_requirements($phase) {
  // Ensure translations don't break during installation.
  $t = get_t();
  
  $requirements = array();
  // Default values, we will change this if we detect a problem.
  $requirements['fileinfo_ext']['title'] = $t('Fileinfo extension');
  $requirements['fileinfo_ext']['severity'] = REQUIREMENT_OK;
  $requirements['fileinfo_ext']['value'] = $t("Found");

  if ($phase == "install" || $phase == "runtime") {
    if (!extension_loaded('fileinfo')) {
      $requirements['fileinfo_ext']['value'] = $t("Fileinfo extension not available");
      $requirements['fileinfo_ext']['severity'] = REQUIREMENT_ERROR;
      $requirements['fileinfo_ext']['description'] = $t('File upload secure validator module uses Fileinfo extension. It seems as if Fileinfo extension is not loaded/enabled. If you are using Windows, may be, you should uncomment php_fileinfo.dll in php.ini file.');
    }
  }

  return $requirements;
}
