You are here

function flysystem_requirements in Flysystem 7

Same name and namespace in other branches
  1. 8 flysystem.install \flysystem_requirements()
  2. 3.x flysystem.install \flysystem_requirements()
  3. 2.0.x flysystem.install \flysystem_requirements()
  4. 3.0.x flysystem.install \flysystem_requirements()

Implements hook_requirements().

File

./flysystem.install, line 11
Install, update, enable hooks for flysystem.module.

Code

function flysystem_requirements($phase) {
  $requirements = array();
  if ($phase !== 'runtime') {
    return $requirements;
  }
  if (!flysystem_dependencies_check()) {
    $requirements['flysystem_dependencies'] = array(
      'title' => t('Flysystem'),
      'description' => t('The Flysystem dependencies are not installed correctly.'),
      'severity' => REQUIREMENT_ERROR,
    );

    // Things will most likely be broken, so don't continue.
    return $requirements;
  }
  foreach (flysystem_factory()
    ->ensure() as $scheme => $errors) {
    foreach ($errors as $error) {
      $requirements['flysystem:' . $scheme] = array(
        'title' => t('Flysystem: @scheme', array(
          '@scheme' => $scheme,
        )),
        'description' => t($error['message'], $error['context']),
        'severity' => _flysystem_convert_watchdog_to_requirements($error['severity']),
      );
    }
  }
  return $requirements;
}