update.make.inc

  1. 8.0.x commands/make/update.make.inc
  2. 7.x commands/make/update.make.inc
  3. master commands/make/update.make.inc

make-update command implementation.

Functions

Namesort descending Description
drush_make_update Command callback for make-update.

File

commands/make/update.make.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * make-update command implementation.
  5. */
  6. /**
  7. * Command callback for make-update.
  8. */
  9. function drush_make_update($makefile = NULL) {
  10. // Process makefile and get projects array.
  11. $info = _make_parse_info_file($makefile);
  12. make_prepare_projects(FALSE, $info);
  13. $make_projects = drush_get_option('DRUSH_MAKE_PROJECTS', FALSE);
  14. // Pick projects coming from drupal.org and adjust its structure
  15. // to feed update_status engine.
  16. // We provide here some heuristics to determine if a git clone comes
  17. // from drupal.org and also guess its version.
  18. // #TODO# move git checks to make_prepare_projects() and use it to leverage
  19. // git_drupalorg engine.
  20. $projects = array();
  21. foreach ($make_projects as $project_name => $project) {
  22. if (($project['download']['type'] == 'git') && !empty($project['download']['url'])) {
  23. // TODO check that tag or branch are valid version strings (with pm_parse_version()).
  24. if (!empty($project['download']['tag'])) {
  25. $version = $project['download']['tag'];
  26. }
  27. elseif (!empty($project['download']['branch'])) {
  28. $version = $project['download']['branch'] . '-dev';
  29. }
  30. /*
  31. elseif (!empty($project['download']['refspec'])) {
  32. #TODO# Parse refspec.
  33. }
  34. */
  35. else {
  36. // If no tag or branch, we can't match a d.o version.
  37. continue;
  38. }
  39. $projects[$project_name] = $project + array(
  40. 'path' => '',
  41. 'label' => $project_name,
  42. 'version' => $version,
  43. );
  44. }
  45. elseif ($project['download']['type'] == 'pm') {
  46. $projects[$project_name] = $project + array(
  47. 'path' => '',
  48. 'label' => $project_name,
  49. );
  50. }
  51. }
  52. // Check for updates.
  53. $update_status = drush_get_engine('update_status');
  54. $update_info = $update_status->getStatus($projects, TRUE);
  55. $security_only = drush_get_option('security-only', FALSE);
  56. foreach ($update_info as $project_name => $project_update_info) {
  57. if (!$security_only || ($security_only && $project_update_info['status'] == DRUSH_UPDATESTATUS_NOT_SECURE)) {
  58. $make_projects[$project_name]['download']['full_version'] = $project_update_info['recommended'];
  59. }
  60. }
  61. // Inject back make projects and generate the updated makefile.
  62. drush_set_option('DRUSH_MAKE_PROJECTS', $make_projects);
  63. make_generate_from_makefile(drush_get_option('result-file'), $makefile);
  64. }