You are here

function fe_paths_requirements in File Entity Paths 7.2

Implements hook_requirements().

File

./fe_paths.install, line 135
Install, update and uninstall functions for the File Entity Paths module. @todo: Figure out, how should this work with Filefield Paths. Now, the filefield_paths has partial media + File Entity support

Code

function fe_paths_requirements($phase) {
  if ($phase == 'update' || $phase == 'install') {
    $return = array();
    $t = get_t();
    $files = system_rebuild_module_data();

    // Check file entity dependency. The version checking was removed from
    // .info, because drupal.org testbot doesn't handle >=7.x-2.0-unstable6
    // style dependecy.
    $file_entity = drupal_check_incompatibility(drupal_parse_dependency('file_entity (>=7.x-2.0-unstable6)'), str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $files['file_entity']->info['version']));
    if (!is_null($file_entity)) {
      $return['fe_paths_file_entity'] = array(
        'title' => $t('File Entity Paths incompatible dependency.'),
        'value' => '',
        'description' => $t('The File Entity Paths needs at least @version of File Entity mödule.', array(
          '@version' => $file_entity,
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }

    // filefield_paths and fe_paths can't work together, no let install the module
    if (module_exists('filefield_paths') || drupal_get_installed_schema_version('filefield_paths') != SCHEMA_UNINSTALLED) {
      $return['fe_paths_ffp'] = array(
        'title' => $t('File Entity Paths status.'),
        'value' => '',
        'description' => $t('The File Entity Paths can\'t work with File (Field) Paths together. You have to disable and uninstall it first.'),
        'severity' => REQUIREMENT_ERROR,
      );
    }
    return $return;
  }
}