summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2011-10-23 17:44:50 +0200
committerRemi Collet <fedora@famillecollet.com>2011-10-23 17:44:50 +0200
commitaf3071cf5bb6121d096cc92029a161ddaccc3af3 (patch)
tree967457d91cd04474018753bb2cbb7a79161a7343
parent0a8e3121c5ab3ef7b2c55732bf0289c212fc0b58 (diff)
fix version order in zoom page, mainly for el repo
-rw-r--r--zoom.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/zoom.php b/zoom.php
index 8b00270..b4fb513 100644
--- a/zoom.php
+++ b/zoom.php
@@ -98,12 +98,20 @@ if ( !isset($name) || !$name ) {
$uptable = new TableUpstream($db);
+ // Consider each part of ver/rel as integer except second part of rel (generally distro name)
$sql = "SELECT rpm.*, repo.active,
CONCAT(repo.url,rpm.name,'-',rpm.ver,'-',rpm.rel,'.src.rpm') as rpmurl
FROM rpm
INNER JOIN repo ON (repo.main=rpm.repo_main AND repo.sub=rpm.repo_sub)
WHERE rpm.name='$name'
- ORDER BY repo.id DESC";
+ ORDER BY repo.id DESC,
+ CAST(SUBSTRING_INDEX(rpm.ver,'.',1) AS SIGNED) DESC,
+ CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(rpm.ver,'.',2),'.',-1) AS SIGNED) DESC,
+ CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(rpm.ver,'.',3),'.',-1) AS SIGNED) DESC,
+ CAST(SUBSTRING_INDEX(rpm.rel,'.',1) AS SIGNED) DESC,
+ SUBSTRING_INDEX(SUBSTRING_INDEX(rpm.rel,'.',2),'.',-1) DESC,
+ CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(rpm.rel,'.',3),'.',-1) AS SIGNED) DESC";
+
$resrpm = $db->query($sql);
$rpm = ($resrpm ? $resrpm->fetchObject() : false);