You are here

function git_deploy_update_projects_alter in Git Deploy 7.2

Same name and namespace in other branches
  1. 8.2 git_deploy.module \git_deploy_update_projects_alter()
  2. 7 git_deploy.module \git_deploy_update_projects_alter()

Implements hook_update_projects_alter().

File

./git_deploy.module, line 266
Adds project, version and date information to projects checked out with Git.

Code

function git_deploy_update_projects_alter(&$projects) {

  // Get projects whose datestamps need to be synced with upstream releases.
  $update = drupal_static('git_deploy_system_info_alter:update', array());

  // Free up memory.
  drupal_static_reset('git_deploy_system_info_alter:projects');
  drupal_static_reset('git_deploy_system_info_alter:available');
  drupal_static_reset('git_deploy_system_info_alter:update');
  if (!empty($update)) {

    // Fetch updated release data.
    module_load_include('inc', 'update', 'update.fetch');
    foreach ($update as $project_name) {
      _update_process_fetch_task($projects[$project_name]);
    }
    $available = _update_get_cached_available_releases();
    foreach ($update as $project_name) {
      $project =& $projects[$project_name];
      $version = $project['info']['version'];
      if (isset($available[$project_name]['releases'][$version])) {
        _git_deploy_datestamp_sync($project, $available[$project_name]['releases'][$version]);
      }
    }
  }
}