summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);