cvs: phpweb /releases index.php
| From: | Hannes Magnusson | Date: | Thu, 06 Sep 2007 14:33:20 +0000 |
| Subject: | cvs: phpweb /releases index.php | ||
| Groups: | php.mirrors php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-10@lists.php.net to get a copy of this message | ||
bjori Thu Sep 6 14:33:20 2007 UTC
Modified files:
/phpweb/releases index.php
Log:
Add RESTish support to retrieve latest PHP releases in serialize()d format
# To get the latest PHP5 release: ?serialize=1&version=5
# To get the latest PHP4 release: ?serialize=1&version=4
# To get the latest PHP release in all branches: ?serialize=1
# To get all PHP5 releases: ?serialize=1&version=5&max=-1
# To get the 5last PHP5 releases: ?serialize=1&version=5&max=5
# and so on...
http://cvs.php.net/viewvc.cgi/phpweb/releases/index.php?r1=1.15&r2=1.16&diff_format=u
Index: phpweb/releases/index.php
diff -u phpweb/releases/index.php:1.15 phpweb/releases/index.php:1.16
--- phpweb/releases/index.php:1.15 Thu Sep 6 14:26:40 2007
+++ phpweb/releases/index.php Thu Sep 6 14:33:19 2007
@@ -1,9 +1,54 @@
<?php
-// $Id: index.php,v 1.15 2007/09/06 14:26:40 bjori Exp $
+// $Id: index.php,v 1.16 2007/09/06 14:33:19 bjori Exp $
$_SERVER['BASE_PAGE'] = 'releases/index.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER["DOCUMENT_ROOT"] . "/include/releases.inc";
+if (isset($_GET["serialize"])) {
+ include_once $_SERVER["DOCUMENT_ROOT"] . "/include/version.inc";
+
+ if (isset($_GET["version"])) {
+ $ver = (int)$_GET["version"];
+
+ if (isset($RELEASES[$ver])) {
+ list($version, $r) = each($RELEASES[$ver]);
+
+ if (isset($_GET["max"])) {
+ $max = (int)$_GET["max"];
+ if ($max == -1) { $max = PHP_INT_MAX; }
+
+ $return = array($version => $r);
+
+ $count = 1;
+ foreach($OLDRELEASES[$ver] as $version => $release) {
+ if ($max <= $count++) {
+ break;
+ }
+
+ $return[$version] = $release;
+ }
+ echo serialize($return);
+ } else {
+ $r["version"] = $version;
+
+ echo serialize($r);
+ }
+ } else {
+ echo serialize(array("error" => "Unkown version"));
+ }
+ } else {
+ $array = array();
+ foreach($RELEASES as $major => $release) {
+ list($version, $r) = each($release);
+ $r["version"] = $version;
+ $array[$major] = $r;
+ }
+ echo serialize($array);
+ }
+ return;
+}
+
+
// Tarball list generated with:
// cvs status -v php[34]/INSTALL |grep 'php_'|awk '{print $1}'|grep -Ev
'(RC[0-9]*|rc[_0-9]*|REL|[ab][a0-9-]+|b..rc.|b.pl.|bazaar|pre|[ab])$'|sed -e
's,php_,,' -e 's,_,.,g'|sort -n|while read ver; do echo " <option
value=\"php-${ver}.tar.gz\">$ver</option>"; done
$SIDEBAR_DATA = '