You are here

function gdpr_tasks_requirements in General Data Protection Regulation 8

Same name and namespace in other branches
  1. 8.2 modules/gdpr_tasks/gdpr_tasks.install \gdpr_tasks_requirements()
  2. 3.0.x modules/gdpr_tasks/gdpr_tasks.install \gdpr_tasks_requirements()

Implements hook_requirements().

File

modules/gdpr_tasks/gdpr_tasks.install, line 11
Install file for gdpr_tasks.

Code

function gdpr_tasks_requirements() {
  $requirements = [];
  if (FALSE === \Drupal::hasService('stream_wrapper.private') && FALSE === \Drupal::service('file_system')
    ->validScheme('private')) {
    $requirements['gdpr_tasks']['title'] = t('Private Files');
    $requirements['gdpr_tasks']['description'] = t('The private files folder is not set up.');
    $requirements['gdpr_tasks']['severity'] = REQUIREMENT_ERROR;
    return $requirements;
  }
  $destination = 'private://';
  if (!\is_dir($destination)) {
    $requirements['gdpr_tasks']['title'] = t('Private Files');
    $requirements['gdpr_tasks']['description'] = t('The private files folder does not exist.');
    $requirements['gdpr_tasks']['severity'] = REQUIREMENT_ERROR;
    return $requirements;
  }
  if (!\is_writable($destination)) {
    $requirements['gdpr_tasks']['title'] = t('Private Files');
    $requirements['gdpr_tasks']['description'] = t('The private files is not writable.');
    $requirements['gdpr_tasks']['severity'] = REQUIREMENT_ERROR;
    return $requirements;
  }
  return $requirements;
}