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