<?php require_once "init.php"; require_once BASE . "/lib/style.php"; require_once BASE . "/lib/mysql.php"; $options = explode('?', $_SERVER['REQUEST_URI'], 2); $uri_parts = explode('/', $options[0]); if (count($options) == 2) $options = $options[1]; else $options = ''; if ($uri_parts[count($uri_parts)-1] == '') array_pop($uri_parts); if ($uri_parts[0] != '' || $uri_parts[1] != 'groups') throw_http_error(422, 'Unprocessable Entity'); array_splice( $uri_parts, 0, 2 ); $arch_filter = '1'; if (count($uri_parts) != 0) { $repo_arch = $uri_parts[0]; $arch_filter = '`r_a`.`name`=from_base64("' . base64_encode($repo_arch) . '")'; array_splice( $uri_parts, 0, 1 ); } if (count($uri_parts) == 0) { $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 " <div class=\"box\">\n"; print " <h2>Package Groups Overview</h2>\n"; print_listing($groups, true, 'group'); print " </div>\n"; print_footer(); die(); } if (count($uri_parts) != 1) throw_http_error(422, 'Unprocessable Entity'); $group = $uri_parts[0]; $group_filter = '`install_targets`.`name`=from_base64("' . base64_encode($group) . '")'; $packages = query_package_listing( mysql_join_binary_packages_install_target_providers() . mysql_join_install_target_providers_install_targets() . ' WHERE ' . $arch_filter . ' AND ' . $group_filter, '', array(), false, true ); if (count($packages) == 0) throw_http_error(404, 'Not Found'); print_header('Group Details'); print " <div class=\"box\">\n"; print " <h2>\n"; print " Group Details - " . $group . " (" . $repo_arch . ")\n"; print " </h2>\n"; print " <p>" . count($packages) . " packages found.</p>\n"; print_listing($packages, true, 'package'); print " </div>\n"; print_footer();