[go: nahoru, domu]

Skip to content

Commit

Permalink
Add direct download link for latest stable version
Browse files Browse the repository at this point in the history
Fixes phpmyadmin/phpmyadmin#11469

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Dec 1, 2015
1 parent a82dbe6 commit 389ea3d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
14 changes: 13 additions & 1 deletion files/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from django.views.generic.detail import DetailView
from django.core.urlresolvers import reverse
from django.http import HttpResponse, Http404
from files.models import Release, get_current_releases
from django.shortcuts import redirect
from files.models import Release, get_current_releases, Download
import json


Expand Down Expand Up @@ -81,3 +82,14 @@ def version_json(request):
json.dumps(response, indent=4),
content_type='application/json'
)


def latest_download(request, flavor, extension):
latest = Release.objects.filter(stable=True)[0]
try:
result = latest.download_set.get(
filename__endswith='-{0}{1}'.format(flavor, extension)
)
return redirect(result, permanent=False)
except Download.DoesNotExist:
raise Http404("No release found matching the query")
13 changes: 13 additions & 0 deletions pmaweb/templates/about-website.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,17 @@ <h2 id="syndicate">Syndication</h2>
<li><a href="/home_page/version.json">version.json</a> - JSON with version and release date information</li>
</ul>

<p>You can also directly download latest version on following URLs:</p>

This comment has been minimized.

Copy link
@lem9

lem9 Dec 1, 2015

Contributor

I think that this section should be on the Downloads page.

This comment has been minimized.

Copy link
@nijel

nijel Dec 1, 2015

Author Contributor

I'm not really sure what's best place for this - IMHO it should be next to other options for machine readable data. Maybe just link this from the downloads page?

This comment has been minimized.

Copy link
@lem9

lem9 Dec 1, 2015

Contributor

Makes sense.


<ul>
<li><a href="/downloads/phpMyAdmin-latest-all-languages.tar.bz2">/downloads/phpMyAdmin-latest-all-languages.tar.bz2</a></li>
<li><a href="/downloads/phpMyAdmin-latest-all-languages.tar.gz">/downloads/phpMyAdmin-latest-all-languages.tar.gz</a></li>
<li><a href="/downloads/phpMyAdmin-latest-all-languages.tar.xz">/downloads/phpMyAdmin-latest-all-languages.tar.xz</a></li>
<li><a href="/downloads/phpMyAdmin-latest-all-languages.xz">/downloads/phpMyAdmin-latest-all-languages.xz</a></li>
<li><a href="/downloads/phpMyAdmin-latest-english.tar.bz2">/downloads/phpMyAdmin-latest-english.tar.bz2</a></li>
<li><a href="/downloads/phpMyAdmin-latest-english.tar.gz">/downloads/phpMyAdmin-latest-english.tar.gz</a></li>
<li><a href="/downloads/phpMyAdmin-latest-english.tar.xz">/downloads/phpMyAdmin-latest-english.tar.xz</a></li>
<li><a href="/downloads/phpMyAdmin-latest-english.xz">/downloads/phpMyAdmin-latest-english.xz</a></li>
</ul>

{% endblock %}
10 changes: 9 additions & 1 deletion pmaweb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
from django.views.generic import TemplateView
from pmaweb.views import PMAView, redirect_home_page
from security.views import PMASAView, PMASADraftView, redirect_security
from files.views import ReleaseList, ReleaseDetail, version_json
from files.views import (
ReleaseList, ReleaseDetail, version_json, latest_download
)
from news.views import PostArchive, PostDetail
from news.feeds import NewsFeed
from files.feeds import ReleaseFeed
Expand Down Expand Up @@ -342,6 +344,12 @@
content_type='text/plain'
)
),
url(
r'^downloads/phpMyAdmin-latest-'
r'(?P<flavor>all-languages|english)'
r'(?P<extension>\.zip|\.tar\.gz|\.tar\.xz|\.tar\.bz2)$',
latest_download,
),
url(
r'^(home_page/)?version\.js$',
TemplateView.as_view(
Expand Down

0 comments on commit 389ea3d

Please sign in to comment.