[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#752384: HEAnet sourceforge mirror is outdated



Hi Paul,

On 11/09/14 04:20, Paul Wise wrote:
> On Tue, Jul 22, 2014 at 5:29 PM, Daniel Lintott wrote:
> 
>> I shall drop another version of the patch to the bug report that reverts
>> the custom caching mechanism.
> 
> A yak shaving exercise reminded me that this hasn't been done yet,
> could you please send the updated patch?
> 

Apologies for not getting this done sooner, got tied up with some other
projects.

Attached is a new patch against the old sf.wml from SVN, that doesn't
include any caching mechanism.

Regards

Daniel
--- ../sf-redirect-old/sf.wml	2014-07-21 19:24:00.835216162 +0100
+++ sf.wml	2014-09-11 11:46:00.277558546 +0100
@@ -1,21 +1,10 @@
 <?php
-
-$data_dir = '/srv/qa.debian.org/data/watch';
-
 // need to strip leading slash, sf.net doesn't like double slashes
 $project=ltrim($_SERVER['PATH_INFO'], '/');
 
 if (!$project) {
-    header('Location: http://manpages.debian.net/cgi-bin/man.cgi?query=uscan');
-    exit;
-}
-
-$fdb = $data_dir . '/sf-list.db';
-
-if (!file_exists($fdb)) {
-    header('HTTP/1.0 500 Internal Server Error');
-    die('The files database is not available. Please report this message to'.
-	' debian-qa@lists.debian.org');
+	header('Location: http://manpages.debian.net/cgi-bin/man.cgi?query=uscan');
+	exit;
 }
 
 // $project is not a file and doesn't have trailing slash
@@ -29,40 +18,31 @@
     exit;
 }
 
-$db = dba_open($fdb, 'r', 'db4');
-
-if (!dba_exists($project, $db)) {
-    header('HTTP/1.0 404 File Not Found');
-    die('There is no information about the '.$project.' project.');
-}
+$xml_url = "https://sourceforge.net/projects/$project/rss";;
 
-?><html>
+$xml = simplexml_load_file($xml_url, 'SimpleXMLElement', LIBXML_NOCDATA);
+$title = $xml->channel[0]->title;
+$files = $xml->channel[0]->item;
+?>
+<html>
 <head>
-<title>File listing for project <?php echo htmlspecialchars($project); ?></title>
+<title>File listing for project <?php echo $title; ?></title>
 </head>
 <body>
 <p>
-<h1>File listing for project <?php echo htmlspecialchars($project); ?></h1>
-Visit <a href="http://sf.net/projects/<?php echo htmlspecialchars($project); ?>"><?php echo
-htmlspecialchars($project); ?>'s project page</a>.<br/><br/>
+<h1>File listing for project <?php echo $title; ?></h1>
+Visit <a href="http://sf.net/projects/<?php echo $project; ?>"><?php echo $project; ?>'s project page</a>.<br><br>
 <?php
-echo dba_fetch($project, $db);
+foreach ($files as $item) {
+	$file = basename($item->title);
+	$link = $_SERVER['SCRIPT_NAME'] . "/$project/$file";
+	echo "<a href='$file'>$file</a><br>\n";
+}
 ?>
 </p>
 <p>
-Thanks to <a href="http://ftp.heanet.ie/";>HEAnet's mirror service</a>
-for being the source of data for this service.
-</p>
-<p>
 Get the source code: <a href="svn://anonscm.debian.org/svn/qa/trunk/wml/watch">checkout SVN repository</a> &#124;
 <a href="http://anonscm.debian.org/viewvc/qa/trunk/wml/watch/";>browse SVN repository</a>
 </p>
-<p> Last database update:
-<?php echo date(DATE_RFC822, filemtime($fdb)); ?>
-</p>
 </body>
-</html><?php
-
-dba_close($db);
-
-?>
+</html>

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: