Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In order into #2987842: Improve clickpath for Downloading Drupal, we must create a menu callback that always downloads the latest tarball or zip. This allows us to reduce "Download Drupal 8.5.5" and "Download tar.gz" into a single "Download tar.gz" click.
It also allows us to simplify the steps to use the Drupal quick start commands from:
$ curl -sS https://ftp.drupal.org/files/projects/drupal-x.y.z.zip --output drupal-x.y.z.zip
$ unzip drupal-x.y.z.zip
$ cd /path/to/drupal-x.y.z
$ php core/scripts/drupal quick-start
Which requires a user to look up the latest version of Drupal and replace strings like "drupal-x.y.z.zip", to:
$ curl -L https://www.drupal.org/download-latest/tarball > drupal.tar.gz
$ mkdir drupal && tar -zxvf drupal.tar.gz -C drupal --strip-components=1
$ cd drupal
$ php core/scripts/drupal quick-start
Comment | File | Size | Author |
---|---|---|---|
#13 | 2987842-download-latest-13.patch | 3.76 KB | grasmash |
Comments
Comment #2
grasmash CreditAttribution: grasmash at Acquia commentedComment #3
mlhess CreditAttribution: mlhess as a volunteer commentedI think, but am not positive that
will create a release, as in create a tarball. Was this tested on a dev site?
Comment #4
mlhess CreditAttribution: mlhess as a volunteer commentedComment #5
grasmash CreditAttribution: grasmash at Acquia commentedI thought you'd need to actually call
$release_package->createPackage()
to create a release? Instantiating the object only sets the object properties in the constructor.Yes, I tried it on a dev site and it worked. Visit http://docinitiative-drupal.dev.devdrupal.org/download-latest/tarball
Comment #6
grasmash CreditAttribution: grasmash at Acquia commentedUpdating patch as per @mlhess suggestions.
Comment #7
mlhess CreditAttribution: mlhess as a volunteer commentedThis look better.
A few things
1) all anon urls are cached by fastly. So when a new version of core is released, we would want to call
drupalorg_fastly_purge_url()
for these paths otherwise users might download an old version.I am not sure where we would want to put that, we could put it in the packager, but it won't work correctly for security releases as they are not published at the time they are built, so it would clear the cache, but then load the old url. My guess is it should go in a hook_node_update and look for the release node being published. The packager will do this, and the security team does it by hand.
Lets give it a few days and see if anyone else wants to weight in?
Comment #8
drummftp.drupal.org
should not be hard-coded. Useproject_release_add_download_base()
instead.entity_metadata_wrapper()
to make traversing the field collection items more-readable code.tar.gz
extension. Should we use that instead oftarball
?drupalorg_fastly_purge_url()
can go near the existing call to it indrupalorg_node_update()
.Comment #9
grasmash CreditAttribution: grasmash at Acquia commentedDone.
I've added a check.
Changed /download-latest/tarball to /download/targz.
Done.
Comment #10
grasmash CreditAttribution: grasmash at Acquia commentedFixing bug regarding strpos().
Comment #11
hansfn CreditAttribution: hansfn commentedI prefer https://www.drupal.org/download/latest/targz (and https://www.drupal.org/download/latest/zip) since then people get a working URL if they strip of "latest/whatever". We might also handle https://www.drupal.org/download/latest/ by redirecting to https://www.drupal.org/project/drupal
In addition, I suggest making "download-latest/" (or "download/latest/" if I get my will) a variable so we are 100% sure that the callback and Fastly purge use the same URLs.
Comment #12
grasmash CreditAttribution: grasmash at Acquia commentedThis issue has been in "needs review" status for 12 days. How can this be moved forward? Are the comments in #11 requirements?
Comment #13
grasmash CreditAttribution: grasmash at Acquia commented@hansfn We can't use "download/" because of pre-existing menu item for path "download/*".
However, I've refactored the paths and added a new one:
The last provides a means for linking to the latest release node. A callback already existed that serves this purpose.
Comment #14
hestenetProviding my review and plus one for this idea.
Assigning to @drumm for final technical review and getting this ready for deployment
Some quick notes:
Comment #15
grasmash CreditAttribution: grasmash at Acquia commentedIn your example, /project/drupal/release would redirect to /project/drupal/releases/8.5.6. It's useful for being able to link to the latest release notes.
Comment #16
drummWe currently have
8/download
as a one-off redirect to the currently-recommended core release page.Comment #18
drummI reverted to the original paths, but with the same extensions as used on the files themselves,
download-latest/zip
&download-latest/tar.gz
, so the code to get the files could be simplified a bit.I also left the redirect to the release page with only the original
8/download
. If we want to change that, we can change it directly indrupalorg_menu()
and add a redirect or alias via the UI.Other notable changes were:
return MENU_NOT_FOUND;
instead ofdrupal_not_found()
, which doubles up the page content.drupalorg/drupalorg.pages.inc
This is site-specific custom code, it should be clean, but hard-coding things happens. grepping the codebase for a string is only marginally worse than grepping for a variable.
Comment #19
drummThis has been deployed: https://www.drupal.org/download-latest/zip