aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/MGA/Advisories.pm15
-rw-r--r--tmpl/advisories.html2
-rw-r--r--tmpl/by_cve.html2
-rw-r--r--tmpl/by_rel.html2
-rw-r--r--tmpl/by_src.html2
5 files changed, 19 insertions, 4 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index 9146242..398f9af 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -118,6 +118,15 @@ sub publish_advisories {
}
}
+sub adv_sort {
+ my $advdb = shift;
+ sort {
+ my $pa = $advdb->{advisories}{$a}{status}{published};
+ my $pb = $advdb->{advisories}{$b}{status}{published};
+ return $pa == $pb ? $b cmp $a : $pb cmp $pa;
+ } @_;
+}
+
sub sort_advisories {
my ($advdb) = @_;
foreach my $adv (keys %{$advdb->{advisories}}) {
@@ -138,6 +147,12 @@ sub sort_advisories {
}
}
}
+ foreach my $by ('by_type', 'by_cve', 'by_rel', 'by_media', 'by_src') {
+ foreach my $k (keys %{$advdb->{$by}}) {
+ $advdb->{$by}{$k} = [ adv_sort($advdb, @{$advdb->{$by}{$k}}) ];
+ }
+ }
+ $advdb->{sorted} = [ adv_sort($advdb, keys $advdb->{advisories}) ];
}
sub process_template {
diff --git a/tmpl/advisories.html b/tmpl/advisories.html
index 513672a..7daaeb3 100644
--- a/tmpl/advisories.html
+++ b/tmpl/advisories.html
@@ -7,6 +7,6 @@
<body>
<h1>Mageia Advisories</h1>
- [% INCLUDE advisories_table.html advlst = advdb.advisories.keys.sort.reverse %]
+ [% INCLUDE advisories_table.html advlst = advdb.sorted %]
</body>
</html>
diff --git a/tmpl/by_cve.html b/tmpl/by_cve.html
index 788f19a..bd4aedd 100644
--- a/tmpl/by_cve.html
+++ b/tmpl/by_cve.html
@@ -7,6 +7,6 @@
<body>
<h1><a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=[% CVE %]">[% CVE %]</a></h1>
- [% INCLUDE advisories_table.html advlst = advdb.by_cve.$CVE.sort.reverse %]
+ [% INCLUDE advisories_table.html advlst = advdb.by_cve.$CVE %]
</body>
</html>
diff --git a/tmpl/by_rel.html b/tmpl/by_rel.html
index f3729e3..ac7dc82 100644
--- a/tmpl/by_rel.html
+++ b/tmpl/by_rel.html
@@ -7,6 +7,6 @@
<body>
<h1>Mageia [% rel %] Advisories</h1>
- [% INCLUDE advisories_table.html advlst = advdb.by_rel.$rel.sort.reverse %]
+ [% INCLUDE advisories_table.html advlst = advdb.by_rel.$rel %]
</body>
</html>
diff --git a/tmpl/by_src.html b/tmpl/by_src.html
index a792c81..4e58347 100644
--- a/tmpl/by_src.html
+++ b/tmpl/by_src.html
@@ -7,6 +7,6 @@
<body>
<h1>Mageia advisories for package [% src %]</h1>
- [% INCLUDE advisories_table.html advlst = advdb.by_src.$src.sort.reverse %]
+ [% INCLUDE advisories_table.html advlst = advdb.by_src.$src %]
</body>
</html>