Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/style.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-18 22:08:31 +0100
committerErich Eckner <git@eckner.net>2019-02-18 22:08:31 +0100
commitd03b6d89fa151b0f486938565f53f8c1f751db6a (patch)
tree1de7042567e970402d234cd3d6d9aa7cf6d2f0bd /lib/style.php
parent28f074140370a8c2a11b995271e4c135b2cc1c7f (diff)
lib/style.php: package_listing_query_order_by() is now integrated in query_package_listing()
Diffstat (limited to 'lib/style.php')
-rw-r--r--lib/style.php46
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/style.php b/lib/style.php
index 99d9840..cc7b47d 100644
--- a/lib/style.php
+++ b/lib/style.php
@@ -124,31 +124,27 @@ $pkglist_sorts = array(
)
);
-function package_listing_query_order_by() {
+function query_package_listing($filter, $limit, $float_columns, $count_only, $extract_order_by_from_get) {
global $pkglist_sorts;
- if (!array_key_exists('sort', $_GET))
- return;
- $criterium = $_GET['sort'];
- if (
- array_key_exists($criterium, $pkglist_sorts) &&
- array_key_exists('mysql', $pkglist_sorts[$criterium])
- )
- return $pkglist_sorts[$criterium]['mysql'] . ',';
-
- if (substr($criterium, 0, 1) != '-')
- return;
- $criterium = substr($criterium, 1);
-
- if (
- array_key_exists($criterium, $pkglist_sorts) &&
- array_key_exists('mysql', $pkglist_sorts[$criterium])
- )
- return $pkglist_sorts[$criterium]['mysql'] . ' DESC,';
- return;
-}
+ $sort = '';
+ if ($extract_order_by_from_get && array_key_exists('sort', $_GET)) {
+ $criterium = $_GET['sort'];
+ if (
+ array_key_exists($criterium, $pkglist_sorts) &&
+ array_key_exists('mysql', $pkglist_sorts[$criterium])
+ )
+ $sort = $pkglist_sorts[$criterium]['mysql'] . ',';
+ elseif (substr($criterium, 0, 1) == '-') {
+ $criterium = substr($criterium, 1);
+ if (
+ array_key_exists($criterium, $pkglist_sorts) &&
+ array_key_exists('mysql', $pkglist_sorts[$criterium])
+ )
+ $sort = $pkglist_sorts[$criterium]['mysql'] . ' DESC,';
+ }
+ }
-function query_package_listing($filter_and_order, $float_columns, $count_only) {
if ($count_only)
$columns = "COUNT(DISTINCT `binary_packages`.`id`)";
else
@@ -176,7 +172,11 @@ function query_package_listing($filter_and_order, $float_columns, $count_only) {
mysql_join_repositories_architectures("","r_a") .
mysql_join_binary_packages_build_assignments() .
mysql_join_build_assignments_package_sources() .
- $filter_and_order
+ $filter .
+ " ORDER BY " .
+ $sort .
+ "`binary_packages`.`pkgname`,`repositories`.`stability`,`repositories`.`name`,`architectures`.`name`" .
+ $limit
);
if ($count_only)
return implode($result -> fetch_assoc());