function package_handler_post_download

8.0.x wget.inc package_handler_post_download($project)
8.0.x git_drupalorg.inc package_handler_post_download($project, $release)
6.x wget.inc package_handler_post_download($project)
6.x git_drupalorg.inc package_handler_post_download($project, $release)
7.x wget.inc package_handler_post_download($project)
7.x git_drupalorg.inc package_handler_post_download($project, $release)
4.x wget.inc package_handler_post_download($project)
4.x git_drupalorg.inc package_handler_post_download($project)
4.x cvs.inc package_handler_post_download($project)
5.x wget.inc package_handler_post_download($project)
5.x git_drupalorg.inc package_handler_post_download($project, $release)
master wget.inc package_handler_post_download($project)
master git_drupalorg.inc package_handler_post_download($project, $release)

Post download action.

This action take place once the project is placed in its final location.

Here we add the project as a git submodule.

1 call to package_handler_post_download()
drush_pm_download in commands/pm/download.pm.inc
Command callback. Download Drupal core or any project.

File

commands/pm/package_handler/git_drupalorg.inc, line 185
Drush PM drupal.org Git extension.

Code

function package_handler_post_download($project, $release) {
  if (drush_get_option('gitsubmodule', FALSE)) {
    // Obtain the superproject path, then add as submodule.
    if (drush_shell_cd_and_exec(dirname($project['full_project_path']), 'git rev-parse --show-toplevel')) {
      $output = drush_shell_exec_output();
      $superproject = $output[0];
      // Add the downloaded project as a submodule of its git superproject.
      $command = array();
      $command[] = 'git submodule add';
      $command[] = drush_get_option('gitsubmoduleaddparams');
      $command[] = $project['repository'];
      // We need the submodule relative path.
      $command[] = substr(realpath($project['full_project_path']), strlen(realpath($superproject)) + 1);
      if (!drush_shell_cd_and_exec($superproject, implode(' ', $command))) {
        return drush_set_error('DRUSH_PM_GIT_CHECKOUT_PROBLEMS', dt('Unable to add !name as a git submodule of !super.', array('!name' => $project['name'], '!super' => $superproject)));
      }
    }
    else {
      return drush_set_error('DRUSH_PM_GIT_SUBMODULE_PROBLEMS', dt('Unable to create !project as a git submodule: !dir is not in a Git repository.', array('!project' => $project['name'], '!dir' => dirname($project['full_project_path']))));
    }
  }

  if (drush_get_option('gitinfofile', FALSE)) {
    $matches = array();
    if (preg_match('/^(.+).x-dev$/', $release['version'], $matches)) {
      $full_version = drush_pm_git_drupalorg_compute_rebuild_version($project['full_project_path'], $matches[1]);
    }
    else {
      $full_version = $release['version'];
    }
    if (drush_shell_cd_and_exec(dirname($project['full_project_path']), 'git log -1 --pretty=format:%ct')) {
      $output = drush_shell_exec_output();
      $datestamp = $output[0];
    }
    else {
      $datestamp = time();
    }
    drush_pm_inject_info_file_metadata($project['full_project_path'], $project['name'], $full_version, $datestamp);
  }

}