When attempting to download the recommended Drupal 5.x release of a module, when operating without a drupal root, it defaults to getting the Drupal 6.x release

Moya:~ adrian$ drush dl admin_menu-5.x
Project admin_menu (6.x-1.3) downloaded to /Users/adrian/.           [success]

I ended up having to go to the module page, and retrieving the correct version , ie: admin-menu-5.x-2.8

At the very least this should be documented.

CommentFileSizeAuthor
#1 463110.patch3 KBowen barton

Comments

owen barton’s picture

Status: Active » Needs review
StatusFileSize
new3 KB

Drush previously would default to Drupal 6.x if you were outside of a bootstrapped site - so this was trying to get admin_menu-6.x-5.x-dev - which could not be found, and so it defaulted to the latest stable version. Obviously not what you expected.

The attached patch improves this, so if you are not within a bootstrapped site the first version parameter will be used as the Drupal core version (overriding the default). The second value will be used as the project version, or the latest stable version will be found if it is not present.

If you are within a bootstrapped site the Drupal version will default to your Drupal version and the first value will be interpreted as the project version (assuming a second value is not present).

/tmp$ drush dl admin_menu-5.x
Project admin_menu (5.x-2.8) downloaded to modules/.                 [success]
/tmp$ drush dl admin_menu
Project admin_menu (6.x-1.3) downloaded to modules/.                 [success] [...defaults to latest stable Drupal core version]
/tmp$ drush dl admin_menu-6.x-1.1
Project admin_menu (6.x-1.1) downloaded to modules/.                 [success]
/tmp$ drush dl admin_menu-2.3
No release history available for admin_menu 2.3.                     [error] [...doesn't know what Drupal core version to use, since this is not bootstrapped and there is no way to tell what this version number means]
An error occurred at function : drush_pm_dl                          [error]
/tmp$ drush dl drupal
Project drupal (6.12) downloaded to /tmp/.                           [success]
/tmp$ drush dl drupal-5.10
Project drupal (5.10) downloaded to /tmp/.                           [success]
/tmp$ drush dl drupal-7.x
Project drupal (7.x-dev) downloaded to /tmp/.                        [success]
/tmp$ drush dl admin_menu-6.x-1.x
Project admin_menu (6.x-1.x-dev) downloaded to modules/.             [success]
~/workspace/drupal-5$ drush dl admin_menu

Project admin_menu (5.x-2.8) downloaded to                           [success]
/home/obarton/workspace/drupal-5/sites/all/modules/.
~/workspace/drupal-5$ drush dl admin_menu-2.3
Project admin_menu (5.x-2.3) downloaded to                           [success]
/home/obarton/workspace/drupal-5/sites/all/modules/.

~/workspace/drupal-6$ drush dl admin_menu
Project admin_menu (6.x-1.3) downloaded to                           [success]
/home/obarton/workspace/drupal-6/sites/all/modules/.
~/workspace/drupal-6$ drush dl admin_menu-2.3
Project admin_menu (6.x-1.3) downloaded to                           [success] [...not a valid 6.x version so we get the stable instead - there is a notice if you have verbose on]
/home/obarton/workspace/drupal-6/sites/all/modules/.
~/workspace/drupal-6$ drush dl admin_menu-1.0
Project admin_menu (6.x-1.0) downloaded to                           [success]
/home/obarton/workspace/drupal-6/sites/all/modules/.
owen barton’s picture

Status: Needs review » Fixed

Committed this

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.