summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-19 10:08:22 +0100
committerErich Eckner <git@eckner.net>2019-02-19 10:08:22 +0100
commita9a7913736a77313a730d21de67118ac5bf656bc (patch)
tree5eca954d7cd95ab3faa56e71435b9e8cf17f58cf
parent1891c18d82c7714e02db96d0da44dbf09e93777d (diff)
downloadwebsite-a9a7913736a77313a730d21de67118ac5bf656bc.tar.xz
groups.php: show list of groups
-rw-r--r--groups.php47
1 files changed, 44 insertions, 3 deletions
diff --git a/groups.php b/groups.php
index 349cc0b..cfea8f4 100644
--- a/groups.php
+++ b/groups.php
@@ -36,11 +36,52 @@ if (count($uri_parts) != 0) {
}
if (count($uri_parts) == 0) {
- // TODO: display overwiev
- print 'Good so far, but the rest is yet to be implemented.';
- die();
+ $sort = '';
+ if (array_key_exists('sort', $_GET)) {
+ $criterium = $_GET['sort'];
+ if (
+ array_key_exists($criterium, $grouplist_sorts) &&
+ array_key_exists('mysql', $grouplist_sorts[$criterium])
+ )
+ $sort = $grouplist_sorts[$criterium]['mysql'] . ',';
+ elseif (substr($criterium, 0, 1) == '-') {
+ $criterium = substr($criterium, 1);
+ if (
+ array_key_exists($criterium, $grouplist_sorts) &&
+ array_key_exists('mysql', $grouplist_sorts[$criterium])
+ )
+ $sort = $grouplist_sorts[$criterium]['mysql'] . ' DESC,';
+ }
+ }
+
+ $result = mysql_run_query(
+ 'SELECT ' .
+ '`install_targets`.`name`,' .
+ 'COUNT(DISTINCT `install_target_providers`.`package`) AS `count`,' .
+ 'MAX(`binary_packages_in_repositories`.`last_moved`) AS `last_moved`,' .
+ '`architectures`.`name` AS `arch`' .
+ ' FROM `install_targets`' .
+ mysql_join_install_targets_install_target_providers() .
+ mysql_join_install_target_providers_binary_packages_in_repositories() .
+ mysql_join_binary_packages_in_repositories_repositories() .
+ ' AND `repositories`.`is_on_master_mirror`' .
+ mysql_join_repositories_architectures() .
+ ' WHERE `install_target_providers`.`install_target_is_group`' .
+ ' GROUP BY CONCAT(`architectures`.`name`,"/",`install_targets`.`name`)' .
+ ' ORDER BY ' . $sort . '`install_targets`.`name`,`architectures`.`name`'
+ );
+ $groups = array();
+ while ($row = $result -> fetch_assoc()) {
+ $row['move_date'] = substr($row['last_moved'], 0, 10);
+ $groups[] = $row;
+ }
+
print_header('Package Groups');
+ print_listing($groups, true, 'group');
+ print_footer();
+
+ die();
}
if (count($uri_parts) != 1)