function package_handler_post_download

8.0.x package_handler_post_download($project)
8.0.x package_handler_post_download($project, $release)
6.x package_handler_post_download($project)
6.x package_handler_post_download($project, $release)
7.x package_handler_post_download($project)
7.x package_handler_post_download($project, $release)
4.x package_handler_post_download($project)
4.x package_handler_post_download($project)
4.x package_handler_post_download($project)
5.x package_handler_post_download($project)
5.x package_handler_post_download($project, $release)
master package_handler_post_download($project)
master 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/
Command callback. Download Drupal core or any project.


commands/pm/package_handler/, line 169
Drush PM Git extension.


function package_handler_post_download($project) {
  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($project['full_project_path'], strlen($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']))));