From 8906da52848b6c6d0e42e3d8689f17be64dbe57b Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 11 Feb 2019 09:28:26 +0100 Subject: feeds/feed.php: some working state --- feeds/feed.php | 93 ++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 18 deletions(-) (limited to 'feeds/feed.php') diff --git a/feeds/feed.php b/feeds/feed.php index 1176eb4..cb6fd47 100644 --- a/feeds/feed.php +++ b/feeds/feed.php @@ -50,45 +50,87 @@ if ($uri_parts[0] == 'packages') { if (count($uri_parts) > 0 && array_key_exists($uri_parts[0], $actions)) { $action = $uri_parts[0]; - array_splice( - $uri_parts, - 0, 1 - ); + $action_filter = 'unimplemented'; + array_splice( + $uri_parts, + 0, 1 + ); } - else + else { $action = ''; + $action_filter = '`repositories`.`is_on_master_mirror`'; + } if (count($uri_parts) > 0) { if (!array_key_exists($uri_parts[0], $archs)) throw_http_error(501, "Not Implemented", implode('/',$uri_parts)); $arch = $uri_parts[0]; + $arch_filter = ' AND `r_a`.`name`="' . $arch . '"'; array_splice( $uri_parts, 0, 1 ); } - else + else { $arch = ''; + $arch_filter = ''; + } if (count($uri_parts) > 0) { if (!array_key_exists($uri_parts[0], $repos)) throw_http_error(501, "Not Implemented", implode('/',$uri_parts)); $repo = $uri_parts[0]; + $repo_filter = ' AND `repositories`.`name`="' . $repo . '"'; array_splice( $uri_parts, 0, 1 ); } - else + else { $repo = ''; + $repo_filter = ''; + } if (count($uri_parts) != 0) throw_http_error(501, "Not Implemented", implode('/',$uri_parts)); -# $result = mysql_run_query( -# TODO -# ); + $result = mysql_run_query( + "SELECT MAX(`build_assignments`.`return_date`) AS `max_build_date`" . + " FROM `build_assignments`" . + mysql_join_build_assignments_binary_packages() . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_architectures("", "r_a") . + " WHERE " . $action_filter . $repo_filter . $arch_filter + ); + $max_build_date = $result -> fetch_assoc(); + $max_build_date = $max_build_date['max_build_date']; + + $result = mysql_run_query( + "SELECT `binary_packages`.`pkgname`," . + "`binary_packages`.`epoch`," . + "`binary_packages`.`pkgver`," . + "`binary_packages`.`pkgrel`," . + "`binary_packages`.`sub_pkgrel`," . + "`binary_packages`.`sub_pkgrel_omitted`," . + "`architectures`.`name` AS `architecture`," . + "`repositories`.`name` AS `repo`," . + "`r_a`.`name` AS `r_a`," . + "`binary_packages_in_repositories`.`last_moved`" . + " FROM `binary_packages`" . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_architectures("", "r_a") . + mysql_join_binary_packages_architectures() . + " WHERE " . $action_filter . $repo_filter . $arch_filter . + " ORDER BY `binary_packages_in_repositories`.`last_moved` DESC" . + " LIMIT 50" + ); + $packages = array(); + while ($row = $result -> fetch_assoc()) + $packages[] = $row; + print ""; print ""; print ""; print ""; @@ -112,7 +154,7 @@ if ($uri_parts[0] == 'packages') { print ")"; print ""; print ""; - print "https://archlinux32.org/packages/"; + print "https://www.archlinux32.org/packages/"; print ""; print ""; switch ($action) { @@ -127,32 +169,47 @@ if ($uri_parts[0] == 'packages') { break; } if ($arch != 'all') - print " for the " . $arch . " architecture (including 'any' packages)"; + print " for the '" . $arch . "' architecture (including 'any' packages)"; else print " for all architectures"; if ($repo != '') - print " for the " . $repo . " repository"; + print " in the [" . $repo . "] repository"; + print "."; print ""; - print ""; - print ""; + print ""; + print ""; print ""; print "en-us"; print ""; print ""; -# TODO + print $max_build_date; print ""; foreach ($packages as $package) { print ""; print ""; print $package['pkgname']; - if (array_key_exists('epoch',$package)) + if ($package['epoch'] != 0) print $package['epoch'] . ":"; print $package['pkgver'] . "-" . $package['pkgrel']; if (!$package['sub_pkgrel_omitted']) print '.' . $package['sub_pkgrel']; print ' ' . $package['architecture']; print ""; -# TODO + print ""; + print "https://www.archlinux32.org/packages/" . $package['repo'] . "/" . $package['r_a'] . "/" . $package['pkgname'] . "/"; + print ""; +// TODO: description + print ""; + print $package['last_moved']; + print ""; +// TODO: guid + print ""; + print $package['repo']; + print ""; + print ""; + print $package['r_a']; + print ""; +// TODO: all the rest print ""; } print ""; -- cgit v1.2.3-70-g09d2