index : archweb32 | |
Archlinux32 website | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-02-18 14:44:42 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-02-18 14:44:42 +0100 |
commit | 4376c50ded25fff8ab6c59c045522091b3eb038b (patch) | |
tree | 256027697af65501d4b605b3edba9c0f8cee9b07 /lib | |
parent | e5c0107d8c0dca4bdbbfa6fa26c2ef4d8997be6a (diff) |
-rw-r--r-- | lib/style.php | 42 |
diff --git a/lib/style.php b/lib/style.php index 2fe2992..051a0a5 100644 --- a/lib/style.php +++ b/lib/style.php @@ -81,7 +81,47 @@ function print_footer() { * * **********************************************************************/ -function query_package_listing() { +function query_package_listing($filter_and_order, $float_columns, $count_only) { + if ($count_only) + $columns = "COUNT(DISTINCT `binary_packages`.`id`)"; + else + $columns = + "DISTINCT " . + "`binary_packages`.`pkgname`," . + "`package_sources`.`pkgbase`," . + "CONCAT(`r_a`.`name`,\"/\",`repositories`.`name`) AS `repo`," . + "`architectures`.`name` AS `arch`," . + mysql_query_package_version("binary_packages") . + " AS `version`," . + "IF(`binary_packages`.`has_issues`,1,0) AS `has_issues`," . + "`build_assignments`.`return_date` AS `build_date`," . + "`binary_packages_in_repositories`.`last_moved` AS `move_date`," . + "IF(`binary_packages_in_repositories`.`is_to_be_deleted`,1,0) AS `is_to_be_deleted`"; + + $result = mysql_run_query( + "SELECT " . + $columns . + " FROM `binary_packages`" . + mysql_join_binary_packages_architectures() . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + " AND `repositories`.`is_on_master_mirror`" . + mysql_join_repositories_architectures("","r_a") . + mysql_join_binary_packages_build_assignments() . + mysql_join_build_assignments_package_sources() . + $filter_and_order + ); + if ($count_only) + return implode($result -> fetch_assoc()); + else { + $return = array(); + while ($row = $result -> fetch_assoc()) { + foreach ($float_columns as $float_column) + $row[$float_column] = floatval($row[$float_column]); + $return[] = $row; + } + return $return; + } } function print_package_listing($list, $sorts, $print_order_links) { |