You are here

function environment_indicator_ah_valid_post_deploy_hook in Environment Indicator 7.2

Helper function to determine if the Acquia post deploy hook is installed.

Parameters

string $env: String containing the name of the environment as declared in the drush aliases.

Return value

bool Return TRUE if the hook script has been found.

1 call to environment_indicator_ah_valid_post_deploy_hook()
environment_indicator_requirements in ./environment_indicator.install
Implements hook_requirements().

File

./environment_indicator.module, line 697
Module implementation file.

Code

function environment_indicator_ah_valid_post_deploy_hook($env) {
  $valid = FALSE;
  if ($obj = cache_get('ei_ah_valid_hook:' . $env)) {

    // Check if this is in the db cache. To avoid IO operations when possible.
    return $obj->data;
  }

  // Find the base path where the hooks directory is.
  $base_path = DRUPAL_ROOT . '/..';
  $folders = array(
    $env,
    'common',
  );
  foreach ($folders as $folder) {
    $path = "{$base_path}/hooks/{$folder}/post-code-deploy/environment-indicator.sh";
    if (file_exists($path)) {
      $valid = TRUE;
      break;
    }
  }
  cache_set('ei_ah_valid_hook:' . $env, $valid);
  return $valid;
}