r14241 - in /scripts/qa: qareport.cgi templates/by_category

tincho-guest at users.alioth.debian.org tincho-guest at users.alioth.debian.org
Thu Feb 7 05:32:42 UTC 2008


Author: tincho-guest
Date: Thu Feb  7 05:32:41 2008
New Revision: 14241

URL: http://svn.debian.org/wsvn/?sc=1&rev=14241
Log:
Modify the last-modified logic: test mtime of all files under templates/, and
mtime of the cache, not the stamp, as that 1) is not warranteed to be a mtime
(svn is not) and 2) it is not necesarily updated for the root of the cache.

Also add last-modified and retrieved dates to the template.

Modified:
    scripts/qa/qareport.cgi
    scripts/qa/templates/by_category

Modified: scripts/qa/qareport.cgi
URL: http://svn.debian.org/wsvn/scripts/qa/qareport.cgi?rev=14241&op=diff
==============================================================================
--- scripts/qa/qareport.cgi (original)
+++ scripts/qa/qareport.cgi Thu Feb  7 05:32:41 2008
@@ -19,25 +19,27 @@
 use POSIX qw(locale_h);
 use Template ();
 use Date::Parse ();
+use File::Find ();
+use List::Util qw(max);
 
 read_config();
 
 my $cgi = new CGI;
 
 my $cache = read_cache(consolidated => "");
+
+my @modified;
+# Find recent template files
+File::Find::find( { wanted => sub {
+            my $mtime = (stat)[9];
+            push @modified, $mtime if(-f _);
+        } }, $CFG{qareport_cgi}{templates_path} );
 my $script_date = '$Date$';
-$script_date = join( ' ', (split(/ /, $script_date))[1..3] );
-my @modified = sort(
-    map(
-        {
-            # Each key of the consolidated cache works like a root cache
-            find_stamp($cache->{$_}, "")
-        } qw(svn watch archive bts pkglist),
-    ),
-    Date::Parse::str2time($script_date),
-);
-my $last_modified = $modified[-1];
-my $ims;
+push @modified, Date::Parse::str2time(
+    join(' ', (split(/ /, $script_date))[1..3]));
+push @modified, (stat $CFG{common}{cache_dir} . "/consolidated")[9];
+
+my $last_modified = max @modified;
 my @pkglist = get_pkglist();
 my $cls = classify(@pkglist);
 
@@ -80,7 +82,7 @@
     my $htmlp = $cgi->Accept("text/html");
     my $xhtmlp = $cgi->Accept("application/xhtml+xml");
 
-    $ims = $cgi->http('If-Modified-Since');
+    my $ims = $cgi->http('If-Modified-Since');
     $ims = Date::Parse::str2time($ims) if $ims;
 
     if( $ims and $ims >= $last_modified )
@@ -141,9 +143,12 @@
                 with_bugs   => \@with_bugs,
             )
         ),
-        shown_packages  => scalar(@all),
-        total_packages  => scalar(@pkglist),
-#        params          => scalar($cgi->Vars()),
+        shown_packages => scalar(@all),
+        total_packages => scalar(@pkglist),
+#       params         => scalar($cgi->Vars()),
+        last_modified  => POSIX::strftime("%a, %d %b %Y %T %Z",
+            gmtime($last_modified)),
+        now            => POSIX::strftime("%a, %d %b %Y %T %Z", gmtime(time)),
     },
 ) || die $tt->error;
 

Modified: scripts/qa/templates/by_category
URL: http://svn.debian.org/wsvn/scripts/qa/templates/by_category?rev=14241&op=diff
==============================================================================
--- scripts/qa/templates/by_category (original)
+++ scripts/qa/templates/by_category Thu Feb  7 05:32:41 2008
@@ -290,6 +290,8 @@
 </p>
 [% META id='$Id$' %]
 <p id="page_id">
+    Last modified: $last_modified<br/>
+    Retrieved on: $now<br/>
     <code>$template.id</code>
 </p>
 </body>




More information about the Pkg-perl-cvs-commits mailing list