You are here

function git_deploy_requirements in Git Deploy 8.2

Same name and namespace in other branches
  1. 6.2 git_deploy.install \git_deploy_requirements()
  2. 6 git_deploy.install \git_deploy_requirements()
  3. 7.2 git_deploy.install \git_deploy_requirements()
  4. 7 git_deploy.install \git_deploy_requirements()

Implements hook_requirements().

File

./git_deploy.install, line 11
Checks that site can get version information with Git.

Code

function git_deploy_requirements($phase) {
  $requirements = [];
  if (in_array($phase, [
    'install',
    'runtime',
  ])) {
    $message = t('Available');
    $severity = REQUIREMENT_OK;
    $description = '';
    if (!function_exists('exec')) {
      $message = t('Disabled exec()');
      $description = t('The exec() PHP function is disabled. Git Deploy is unable to work without that.');
      $severity = REQUIREMENT_ERROR;
    }
    elseif (!exec('git')) {
      $message = t('Git not found');
      $description = t('The git binary is not executable from PHP. Git Deploy is unable to work without that.');
      $severity = REQUIREMENT_ERROR;
    }
    $requirements['git_deploy'] = [
      'title' => t('Executable git binary'),
      'value' => $message,
      'severity' => $severity,
      'description' => $description,
    ];
  }
  return $requirements;
}