Skip to content

Commit

Permalink
Merge branch 'master' into bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Aug 8, 2016
2 parents cdcc704 + 5636c4d commit d695c41
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 3 deletions.
9 changes: 7 additions & 2 deletions files/models.py
Expand Up @@ -94,7 +94,10 @@ def simpledownload(self):
filename__endswith='-all-languages.zip'
)
except Download.DoesNotExist:
return self.download_set.all()[0]
try:
return self.download_set.all()[0]
except IndexError:
return None

@staticmethod
def parse_version(version):
Expand Down Expand Up @@ -175,7 +178,9 @@ def get_version_info(self):
'''
Returns description to the phpMyAdmin version.
'''
if self.version[:2] == '1.':
if self.version[:2] == '0.':
text = 'Historical release.'
elif self.version[:2] == '1.':
text = 'Historical release.'
elif self.version[:2] == '2.':
text = 'Version compatible with PHP 4+ and MySQL 3+.'
Expand Down
12 changes: 12 additions & 0 deletions pmaweb/cdn.py
Expand Up @@ -65,3 +65,15 @@ def purge_all_cdn():
('cdn_id', settings.CDN_ID),
]
return perform(URL_ALL, data)


def purge_docs_cdn():
"""Purges all pages on CDN"""
if not settings.CDN_PASSWORD:
return
data = [
('login', settings.CDN_LOGIN),
('passwd', settings.CDN_PASSWORD),
('cdn_id', settings.DOCS_CDN_ID),
]
return perform(URL_ALL, data)
31 changes: 31 additions & 0 deletions pmaweb/management/commands/purge_docs_cdn.py
@@ -0,0 +1,31 @@
# -*- coding: UTF-8 -*-
# vim: set expandtab sw=4 ts=4 sts=4:
#
# phpMyAdmin web site
#
# Copyright (C) 2008 - 2016 Michal Cihar <michal@cihar.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from django.core.management.base import BaseCommand
from pmaweb.cdn import purge_docs_cdn


class Command(BaseCommand):
help = 'Purges all pages in CDN cache'

def handle(self, *args, **options):
purge_docs_cdn()

1 change: 1 addition & 0 deletions pmaweb/settings.py
Expand Up @@ -161,5 +161,6 @@
CDN_LOGIN = 'admins@phpmyadmin.net'
CDN_PASSWORD = ''
CDN_ID = '41205'
DOCS_CDN_ID = '71264'

DOCKERHUB_TOKEN = None
11 changes: 10 additions & 1 deletion pmaweb/templates/_dllist.html
@@ -1,3 +1,12 @@
<p>{{ release.get_version_info }}</p>

{% include '_dltable.html' with download_list=release.download_set.all %}
{% with release.download_set.all as download_list %}

{% if download_list %}
{% include '_dltable.html' %}
{% else %}
<div class="alert alert-warning">
Sorry, but no files to download are available for this release. Most likely this is too old release and we didn't find it in our archives.
</div>
{% endif %}
{% endwith %}
4 changes: 4 additions & 0 deletions pmaweb/templates/files/release_list.html
Expand Up @@ -20,6 +20,7 @@
<th><a href="{{ object.get_absolute_url }}">{{ object }}</a></th>
<td>{{ object.date|date:"Y-m-d" }}</td>
{% with object.simpledownload as file %}
{% if file %}
<td><a href="{{ file.get_absolute_url }}">{{ file.filename }}</a></td>
<td class="size">{{ file.size | filesizeformat }}</td>
<td>
Expand All @@ -29,6 +30,9 @@
[<a href="{{ file.get_absolute_url }}.sha1">SHA1</a>]
[<a href="{{ file.get_absolute_url }}.sha256">SHA256</a>]
</td>
{% else %}
<td colspan="3">Download not available</td>
{% endif %}
{% endwith %}
</tr>
{% endfor %}
Expand Down

0 comments on commit d695c41

Please sign in to comment.