[m-rev.] diff: mailing list archive fix

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jan 8 13:33:32 AEDT 2004


Estimated hours taken: 1.5
Branches: main

Changes to the mailing list archive to handle the fact that
the file names now use four-digit years, not two-digit years.

w3/mailing-lists/rearchive:
	Use %Y instead of %y.

w3/mailing-lists/include/list.inc:
	Use %Y instead of $y.
	Add some extra code to handle the old file names.
	Also fix a misleading variable name (s/$year/$first_year).

Workspace: /home/ceres/fjh/mercury
Index: w3/mailing-lists/include/list.inc
===================================================================
RCS file: /home/mercury1/repository/w3/mailing-lists/include/list.inc,v
retrieving revision 1.5
diff -u -d -r1.5 list.inc
--- w3/mailing-lists/include/list.inc	10 Jan 2000 05:38:04 -0000	1.5
+++ w3/mailing-lists/include/list.inc	8 Jan 2004 02:26:45 -0000
@@ -3,14 +3,14 @@
 $yr=date("Y");
 
 $current_month=date("m");
-$current_year=date("y");
+$current_year=date("Y");
 
-$year=1997;
+$first_year=1997;
 
 $cols=3;
 $width=(int)(100/$cols);
 
-$yrmo=sprintf("%02d%02d", $current_year, $current_month);
+$yrmo=sprintf("%04d%02d", $current_year, $current_month);
 $dir="$list.$yrmo/index.html";
 
 if (file_exists($dir))
@@ -22,7 +22,7 @@
     echo "Current Month (no mail messages)";
 }
 
-while ($yr >= $year)
+while ($yr >= $first_year)
 {
     echo "<H3>$yr</H3>";
     echo "<TABLE width=\"100%\">";
@@ -36,8 +36,14 @@
             break;
         }
 
-        $year_2digits=date("y", mktime(0,0,0,$mo,1,$yr));
-        $yrmo=sprintf("%02d%02d", $year_2digits, $mo);
+        $yrmo=sprintf("%04d%02d", $yr, $mo);
+        $dir="$list.$yrmo/index.html";
+	/* prior to Jan 2004, the file names use two-digit years */
+        $yr_2digits=date("y", mktime(0,0,0,$mo,1,$yr));
+        $yrmo_2digits=sprintf("%02d%02d", $yr_2digits, $mo);
+        if (!file_exists($dir) && file_exists("$list.$yrmo_2digits/index.html")) {
+	    $dir="$list.$yrmo_2digits/index.html";
+	}
         $month_string=date("F", mktime(0,0,0,$mo,1,$yr));
 
         if ($i == 1)
@@ -46,7 +52,6 @@
         }
         echo("\t<TD width=\"$width%\">");
 
-        $dir="$list.$yrmo/index.html";
         if (file_exists($dir))
         {
             echo "<A HREF=\"$dir\">";
Index: w3/mailing-lists/rearchive
===================================================================
RCS file: /home/mercury1/repository/w3/mailing-lists/rearchive,v
retrieving revision 1.3
diff -u -d -r1.3 rearchive
--- w3/mailing-lists/rearchive	13 Mar 2001 16:16:50 -0000	1.3
+++ w3/mailing-lists/rearchive	8 Jan 2004 02:26:41 -0000
@@ -9,7 +9,7 @@
 
 day=`date '+%d'`
 month=`date '+%m'`
-year=`date '+%y'`
+year=`date '+%Y'`
 
 if [ $day = "01" ]
 then

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list