From 43ccda16412ef964f20f16501e2053dd0220d936 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 22 May 2019 12:57:06 +0200 Subject: feeds are now served from a single php file --- feeds/feed.php | 294 -------------------------------------------------------- feeds/index.php | 194 ------------------------------------- 2 files changed, 488 deletions(-) delete mode 100644 feeds/feed.php delete mode 100644 feeds/index.php (limited to 'feeds') diff --git a/feeds/feed.php b/feeds/feed.php deleted file mode 100644 index 65fc372..0000000 --- a/feeds/feed.php +++ /dev/null @@ -1,294 +0,0 @@ -\1\s+(\S+)\s+\S+\s+([0-9]+)\s*\n,', - $listing, - $matches, - PREG_SET_ORDER - ); - $available_isos = array(); - foreach ($matches as $match) { - $available_isos[] = array( - 'file' => $match[1], - 'title' => $match[2] . '-' . $match[3], - 'build_date' => strtotime(str_replace('.', '-', $match[2])), - 'build_type' => $match[3], - 'release_date' => $match[4], - 'size' => $match[5] - ); - } - apcu_store('available_isos', $available_isos, 3600); - } - - header('Content-Type: application/rss+xml; charset=utf-8'); - print ""; - print ""; - print ""; - print ""; - print "Arch Linux 32: Releases"; - print ""; - print ""; - print "https://www.archlinux32.org/download/"; - print ""; - print ""; - print "Release ISOs"; - print ""; - print ""; - print ""; - print ""; - print "en-us"; - print ""; - print ""; - print date('Y-m-d', $available_isos[0]['build_date']); - print ""; - foreach ($available_isos as $available_iso) { - print ""; - print ""; - print $available_iso['title']; - print ""; - // TODO: link to iso description (do we want that?) - print ""; - print ""; - print ""; - print date('Y-m-d', $available_iso['release_date']); - print ""; - // TODO: guid - print ""; - // TODO: url=\"https://www.archlinux32.org/iso/2019.02.01/archlinux-2019.02.01-x86_64.iso.torrent\">"; - print ""; - print ""; - } - print ""; - print ""; - - die(); -} - -if ($uri_parts[0] == 'packages') { - - array_splice( - $uri_parts, - 0, 1 - ); - -// TODO: implement "added" and "removed" - but how? -// $actions = array('' => '', 'added' => 'added', 'removed' => 'removed'); - $actions = array('' => ''); - $archs = array('all' => 'all'); - $result = mysql_run_query( - "SELECT DISTINCT `architectures`.`name` FROM `architectures`" . - mysql_join_architectures_repositories() . - " WHERE `repositories`.`is_on_master_mirror`" . - " ORDER BY `name`" - ); - while ($row = $result -> fetch_assoc()) - $archs[$row['name']] = $row['name']; - $repos = array('' => ''); - $result = mysql_run_query( - "SELECT DISTINCT `repositories`.`name` FROM `repositories` WHERE `repositories`.`is_on_master_mirror` ORDER BY `name`" - ); - while ($row = $result -> fetch_assoc()) - $repos[$row['name']] = $row['name']; - - if (count($uri_parts) > 0 && array_key_exists($uri_parts[0], $actions)) { - $action = $uri_parts[0]; - $action_filter = 'unimplemented'; - array_splice( - $uri_parts, - 0, 1 - ); - } - 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 { - $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 { - $repo = ''; - $repo_filter = ''; - } - - if (count($uri_parts) != 0) - throw_http_error(501, "Not Implemented", implode('/',$uri_parts)); - - $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; - - header('Content-Type: application/rss+xml; charset=utf-8'); - - print ""; - print ""; - print ""; - print ""; - print "Arch Linux 32: "; - switch ($action) { - case '': - print "Recent package updates"; - break; - case 'added': - print "Recent added packages"; - break; - case 'removes': - print "Recent removed packages"; - break; - } - if ($arch != 'all') - print " (" . $arch; - if ($repo != '') - print " [" . $repo . "]"; - if ($arch != '') - print ")"; - print ""; - print ""; - print "https://www.archlinux32.org/packages/"; - print ""; - print ""; - switch ($action) { - case '': - print "Recently updated packages in the Arch Linux 32 package repositories"; - break; - case 'added': - print "Recently added packages to the Arch Linux 32 package repositories"; - break; - case 'removes': - print "Recently removed packages from the Arch Linux 32 package repositories"; - break; - } - if ($arch != 'all') - print " for the '" . $arch . "' architecture (including 'any' packages)"; - else - print " for all architectures"; - if ($repo != '') - print " in the [" . $repo . "] repository"; - print "."; - print ""; - print ""; - print ""; - print ""; - print "en-us"; - print ""; - print ""; - print $max_build_date; - print ""; - foreach ($packages as $package) { - print ""; - print ""; - print $package['pkgname']; - 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 ""; - 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 ""; - print ""; - } - print ""; - print ""; - - die(); - -} - -throw_http_error(501, "Not Implemented"); diff --git a/feeds/index.php b/feeds/index.php deleted file mode 100644 index e74717b..0000000 --- a/feeds/index.php +++ /dev/null @@ -1,194 +0,0 @@ - fetch_assoc()) - $archs[$row['name']] = $row['name'] . '/'; - -$print_archs = array_merge( - array( - '' => '', - 'All Arches' => 'all/' - ), - $archs -); - -$result = mysql_run_query( - "SELECT DISTINCT `repositories`.`name` FROM `repositories` WHERE `repositories`.`is_on_master_mirror` ORDER BY `name`" -); -$repos = array(); -while ($row = $result -> fetch_assoc()) - $repos[$row['name']] = $row['name'] . '/'; - -$print_repos = array_merge( - array( - 'All Repos' => '' - ), - $repos -); - -$bugtracker_projects = array( - 0 => 'All Projects', - 1 => 'Arch Linux 32' -); - -$bugtracker_operations = array( - 'Opened' => '', - 'Edited' => 'topic=edit&', - 'Closed' => 'topic=clo&' -); - -function print_arches_header() { - global $print_archs; - foreach ($print_archs as $arch => $dummy) { - print " \n"; - print " " . $arch . "\n"; - print " \n"; - }; -} - -function print_feeds($prefix) { - global $print_archs; - global $print_repos; - foreach ($print_repos as $repo => $dummy) { - print " \n"; - print " \n"; - print " " . $repo . "\n"; - print " \n"; - foreach ($print_archs as $arch => $dummy) { - if ($arch == '') - continue; - print " \n"; - print " Feed\n"; - print " \n"; - } - print " \n"; - } -} - -function print_feeds_table($prefix) { - print " \n"; - print " \n"; - print " \n"; - print_arches_header(); - print " \n"; - print " \n"; - print " \n"; - print_feeds($prefix); - print " \n"; - print "
\n"; -} - -?> -
-

- RSS Feeds -

-

- Several RSS feeds are available for consumption from the Arch32 website. - The majority of these are package-related and allow feeds to be customized for the updates you care about. -

-

- News Feed -

-

- Grab the - news item feed - to keep up-to-date with the latest news from the Arch Linux development staff. -

-

- Package Feeds -

-

- If you are interested in - all package updates, - then grab this feed. - -

- Recently added packages. (to be implemented) -

- -

- Recently removed packages. (to be implemented) -

- -

- Release Feed -

-

- Grab the - ISO release feed - if you want to help seed the ISO release torrents as they come out. -

-

- Development Feeds -

-

- Subscribe to any of the following to track bug tickets and feature requests from the - Arch Linux 32 Bugtracker: -

- - - - - $dummy) { - print " \n"; -} - -?> - - - - $project) { - print " \n"; - print " \n"; - foreach ($bugtracker_operations as $label => $option) { - print " \n"; - } - print " \n"; -} - -?> - -
- Project - \n"; - print " Recently " . $label . " Tasks\n"; - print "
\n"; - print " " . $project . "\n"; - print " \n"; - print " Feed\n"; - print "
-
-