Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/index.php81
1 files changed, 26 insertions, 55 deletions
diff --git a/packages/index.php b/packages/index.php
index d38cffa..d20d2e7 100644
--- a/packages/index.php
+++ b/packages/index.php
@@ -120,40 +120,14 @@ require_once BASE . "/lib/format.php";
$fuzzy_filter = "";
}
- $query = " 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() .
+ $exact_matches = query_package_listing(
$extra_joins .
$filter . $exact_filter .
- " ORDER BY ";
-
- $query .= "`binary_packages`.`pkgname`,`repositories`.`stability`,`repositories`.`name`,`architectures`.`name`";
-
- $result = mysql_run_query(
- "SELECT 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`" .
- $query
+ " ORDER BY " .
+ "`binary_packages`.`pkgname`,`repositories`.`stability`,`repositories`.`name`,`architectures`.`name`",
+ $float_columns,
+ false
);
- $exact_matches = array();
- while ($row = $result -> fetch_assoc()) {
- foreach ($float_columns as $float_column)
- $row[$float_column] = floatval($row[$float_column]);
- $exact_matches[] = $row;
- }
$sorts = array(
"arch" => array(
@@ -198,6 +172,23 @@ require_once BASE . "/lib/format.php";
)
);
+ $q_f = $extra_joins . $filter . $fuzzy_filter . " ORDER BY ";
+
+ if (isset($_GET["sort"])) {
+ if (isset($sorts[$_GET["sort"]]["mysql"]))
+ $q_f .= $sorts[$_GET["sort"]]["mysql"] . ",";
+ elseif (isset($sorts[substr($_GET["sort"],1)]["mysql"]))
+ $q_f .= $sorts[substr($_GET["sort"],1)]["mysql"] . " DESC,";
+ }
+
+ $q_f .= "`binary_packages`.`pkgname`,`repositories`.`stability`,`repositories`.`name`,`architectures`.`name`";
+
+ $num_results = query_package_listing(
+ $q_f,
+ array(),
+ true
+ );
+
$query = " FROM `binary_packages`" .
mysql_join_binary_packages_architectures() .
mysql_join_binary_packages_binary_packages_in_repositories() .
@@ -219,10 +210,6 @@ require_once BASE . "/lib/format.php";
$query .= "`binary_packages`.`pkgname`,`repositories`.`stability`,`repositories`.`name`,`architectures`.`name`";
- $result = mysql_run_query(
- "SELECT COUNT(DISTINCT `binary_packages`.`id`)" . $query
- );
- $num_results = implode($result -> fetch_assoc());
$pages = max(ceil($num_results / 100), 1);
if (isset($_GET["page"]))
@@ -230,27 +217,11 @@ require_once BASE . "/lib/format.php";
else
$page = 1;
- $result = mysql_run_query(
- "SELECT 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`" .
- $query .
- " LIMIT " . (($page-1)*100) . ", 100"
+ $fuzzy_matches = query_package_listing(
+ $q_f . " LIMIT " . (($page-1)*100) . ", 100",
+ $float_columns,
+ false
);
- $fuzzy_matches = array();
- while ($row = $result -> fetch_assoc()) {
- foreach ($float_columns as $float_column)
- $row[$float_column] = floatval($row[$float_column]);
- $fuzzy_matches[] = $row;
- }
function header_and_footer() {