You are here

function automatic_updates_requirements in Automatic Updates 8

Same name and namespace in other branches
  1. 8.2 automatic_updates.install \automatic_updates_requirements()
  2. 7 automatic_updates.install \automatic_updates_requirements()

Implements hook_requirements().

File

./automatic_updates.install, line 15
Automatic updates install file.

Code

function automatic_updates_requirements($phase) {

  // Mimic the functionality of the vendor checker procedurally since class
  // loading isn't available pre module install.
  $vendor_autoloader = [
    DRUPAL_ROOT,
    'vendor',
    'autoload.php',
  ];
  if (!file_exists(implode(DIRECTORY_SEPARATOR, $vendor_autoloader))) {
    return [
      'not installable' => [
        'title' => t('Automatic Updates'),
        'severity' => REQUIREMENT_ERROR,
        'value' => '1.x',
        'description' => t('This module does not currently support relocated vendor folder and composer-based workflows.'),
      ],
    ];
  }
  if ($phase !== 'runtime') {
    return NULL;
  }
  $requirements = [];
  _automatic_updates_checker_requirements($requirements);
  _automatic_updates_psa_requirements($requirements);
  return $requirements;
}