r6721 - /man-cgi/man.cgi
Author: jfs
Date: Sat Jun 6 10:06:53 2009
New Revision: 6721
URL: http://svn.debian.org/wsvn/?sc=1&rev=6721
Log:
Control if content is up to date and present a warning if its not
Modified:
man-cgi/man.cgi
Modified: man-cgi/man.cgi
URL: http://svn.debian.org/wsvn/man-cgi/man.cgi?rev=6721&op=diff
==============================================================================
--- man-cgi/man.cgi (original)
+++ man-cgi/man.cgi Sat Jun 6 10:06:53 2009
@@ -40,6 +40,8 @@
# !!! man.cgi is stale perl4 code !!!
############################################################################
+use File::stat;
+use Time::localtime;
$www{'title'} = 'Debian Hypertext Man Pages';
$www{'home'} = 'http://manpages.debian.net';
@@ -201,7 +203,7 @@
'Debian Sid', "$manLocalDir/sid/usr/share/man",
);
-# delete not existing releases
+# delete non-existing releases
while (($key,$val) = each %manPath) {
my $counter = 0;
@@ -925,6 +927,8 @@
&http_header("text/html");
print &html_header("$www{'title'}: Index Page") .
"<H1>$www{'head'}</H1>\n\n" . &intro;
+# If the content is out of date print a warning:
+ &out_of_date if is_out_of_date();
&formquery;
local($m) = ($manpath ? $manpath : $manPathDefault);
@@ -962,6 +966,34 @@
print "</BODY>\n</HTML>\n";
0;
}
+
+sub is_out_of_date {
+ my $ret = 0;
+ my $file = $manLocalDir."/timestamp";
+ my $mtime = ctime(stat($file)->mtime);
+# my $current_time = time();
+# $diff = $current_time - $mtime;
+ print "<p><small>Contents last updated $mtime</small></p>";
+ $ret = 1 if -M $file > 60;
+ return $ret;
+}
+
+
+
+sub out_of_date {
+ print <<ETX;
+<p><STRONG><font color="#FF0000">NOTE:</font></STRONG> (2008-05-01) The content
+ available for this service
+are currently out of date due to some <a
+href="http://lists.debian.org/debian-doc/2009/01/msg00068.html">issues</a> with
+its hosting site. As a consequence newer Debian releases might not be listed yet
+and manpages of previous releases are not fully up to date. We are working on
+restoring the service. Sorry for the inconvenience.
+</p>
+ETX
+
+}
+
sub formquery {
local($astring, $bstring);
Reply to: