From af3071cf5bb6121d096cc92029a161ddaccc3af3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 23 Oct 2011 17:44:50 +0200 Subject: fix version order in zoom page, mainly for el repo --- zoom.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'zoom.php') 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); -- cgit