index : website | |
Archlinux32 website - obsolete | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-02-19 10:08:22 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-02-19 10:08:22 +0100 |
commit | a9a7913736a77313a730d21de67118ac5bf656bc (patch) | |
tree | 5eca954d7cd95ab3faa56e71435b9e8cf17f58cf | |
parent | 1891c18d82c7714e02db96d0da44dbf09e93777d (diff) |
-rw-r--r-- | groups.php | 47 |
@@ -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) |