Commit: 10af1e0af51d2955c999c8178cb3f11b84cbd8cf Author: Hannes Magnusson <bj...@mongodb.com> Sun, 27 Oct 2013 18:44:59 -0700 Parents: 732a6e7d9f26d0716974898c143c36e40b683ba9 Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=10af1e0af51d2955c999c8178cb3f11b84cbd8cf Log: Replace hourly-pre-generated release feed with a PHP script Seems to fix couple of things, like actually including all the supported" minor versions, not listing empty windows sections etc etc probably breaks something too Changed paths: M downloads.php M error.php M include/header.inc M index-beta.php M index-stable.php A releases/feed.php Diff: diff --git a/downloads.php b/downloads.php index 451b516..1554fc3 100644 --- a/downloads.php +++ b/downloads.php @@ -76,7 +76,7 @@ site_header("Downloads", array( "rel" => "alternate", "type" => "application/atom+xml", - "href" => $MYSITE . "releases.atom", + "href" => $MYSITE . "releases/feed.php", "title" => "PHP Release feed" ), ), diff --git a/error.php b/error.php index 669328a..7058423 100644 --- a/error.php +++ b/error.php @@ -419,6 +419,7 @@ $uri_aliases = array ( # external shortcut aliases ;) "dochowto" => "phpdochowto", "projects.php" => "projects", // BC + "releases.atom" => "releases/feed.php", // BC, No need to pre-generate it # CVS -> SVN "anoncvs.php" => "git", diff --git a/include/header.inc b/include/header.inc index 9b28820..30bc144 100755 --- a/include/header.inc +++ b/include/header.inc @@ -26,7 +26,7 @@ if (isset($shortname) && $shortname) { <link rel="shortcut icon" href="<?php echo $STATIC_ROOT ?>favicon.ico" /> <link rel="search" type="application/opensearchdescription+xml" href="http://php.net/phpnetimprovedsearch.src" title="Add PHP.net search" /> - <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>releases.atom" title="PHP Release feed" /> + <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>releases/feed.php" title="PHP Release feed" /> <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>feed.atom" title="PHP: Hypertext Preprocessor" /> <?php if (isset($_SERVER['BASE_PAGE'])): ?> diff --git a/index-beta.php b/index-beta.php index 3abd9f9..8955cfd 100644 --- a/index-beta.php +++ b/index-beta.php @@ -158,7 +158,7 @@ site_header("Hypertext Preprocessor", array( "rel" => "alternate", "type" => "application/atom+xml", - "href" => $MYSITE . "releases.atom", + "href" => $MYSITE . "releases/feed.php", "title" => "PHP Release feed" ), diff --git a/index-stable.php b/index-stable.php index c494ba5..37924ee 100644 --- a/index-stable.php +++ b/index-stable.php @@ -224,7 +224,7 @@ site_header("Hypertext Preprocessor", array( "rel" => "alternate", "type" => "application/atom+xml", - "href" => $MYSITE . "releases.atom", + "href" => $MYSITE . "releases/feed.php", "title" => "PHP Release feed" ), diff --git a/releases/feed.php b/releases/feed.php new file mode 100644 index 0000000..c9b7001 --- /dev/null +++ b/releases/feed.php @@ -0,0 +1,79 @@ +<?php +header("Content-Type: application/atom+xml"); + +include __DIR__ . "/../include/version.inc"; + +echo <<< XML +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xmlns:php="http://php.net/ns/releases"> + <title>PHP.net releases</title> + <link href="/releases.atom" rel="self"/> + <icon>/images/news/php-logo.gif</icon> + <author> + <name>Webmaster</name> + <uri>http://php.net/contact</uri> + <email>php-webmaster@lists.php.net</email> + </author> + <id>http://php.net/releases/index.php</id> + +XML; + +/* FIX silly editor highlighting */?><?php + +$FEED_UPDATED = 0; +foreach($RELEASES[5] as $version => $release) { + $published = date(DATE_ATOM, strtotime($release["source"][0]["date"])); + if ($release["announcement"]) { + $id = "http://php.net/releases/" . str_replace(".", "_", $version) . ".php"; + } else { + $id = "http://qa.php.net/#$version"; + } + + echo <<< XML + <entry> + <title>PHP {$version} released!</title> + <id>{$id}</id> + <php:version>{$version}</php:version> + <published>{$published}</published> + <summary type="html">There is a new PHP release in town!</summary> + +XML; + $maxtime = array(); + foreach ($release["source"] as $source) { + if (!isset($source["date"])) { + continue; + } + $maxtime[] = $time = strtotime($source["date"]); + $released = date(DATE_ATOM, $time); + + echo <<< XML + <link rel="enclosure" title="{$source["name"]}" href="/get/{$source["filename"]}/from/this/mirror"> + <php:md5>{$source["md5"]}</php:md5> + <php:releaseDate>{$released}</php:releaseDate> + </link> + +XML; + + } + + $updated = date(DATE_ATOM, max($maxtime)); + +echo <<< XML + <updated>{$updated}</updated> + <content src="{$id}" type="application/xhtml+xml"/> + </entry> + +XML; + + $FEED_UPDATED = max($maxtime, $FEED_UPDATED); +} + +$FEED_UPDATED = date(DATE_ATOM, max($FEED_UPDATED)); + +echo <<< XML + <updated>{$FEED_UPDATED}</updated> +</feed> +XML; + + + -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php