[vhffs-dev] [374] Now adding a 0 if month or day is < 10 in the directory creation of archives

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 374
Author:   gradator
Date:     2006-12-16 21:54:09 +0000 (Sat, 16 Dec 2006)

Log Message:
-----------
Now adding a 0 if month or day is < 10 in the directory creation of archives

Modified Paths:
--------------
    trunk/vhffs-listengine/src/listengine.pl


Modified: trunk/vhffs-listengine/src/listengine.pl
===================================================================
--- trunk/vhffs-listengine/src/listengine.pl	2006-12-14 20:25:50 UTC (rev 373)
+++ trunk/vhffs-listengine/src/listengine.pl	2006-12-16 21:54:09 UTC (rev 374)
@@ -59,7 +59,7 @@
 my $ADMIN		= $vhffs->get_config->get_listengine_listmaster;
 my $SMTP_SERVER = $vhffs->get_config->get_listengine_smtp;
 
-#Be carefule, listengine will create /data/listengine/archives for archives
+#Be careful, listengine will create /data/listengine/archives for archives
 #and /data/listengine/tomoderate for moderation
 my $DIRECTORY = $vhffs->get_config->get_listengine_datadir;
 
@@ -119,18 +119,18 @@
 
 sub archive_it
 {
-    use Date::Simple ('date', 'today');
     my $mail = shift;
     my $list = shift;
-    my $date = today();
 
     my ( $message_id  )=  ($mail->get( 'Message-Id' ) =~ /<(.+)>/);
 
     #Don't archive if message-id is not found
     return if( ( ! defined $message_id ) || ( $message_id eq "" ) );
 
+    my $directory = $DIRECTORY . "/archives/" . $list->get_domain . "/" . $list->get_localpart;
 
-    my $directory = $DIRECTORY."/archives/".$list->get_domain."/".$list->get_localpart."/".$date->year."/".$date->month."/".$date->day."";
+    my ( undef, undef, undef, $day, $month, $year ) = gmtime(time);
+    $directory .= sprintf ('/%.4u/%.2u/%.2u', $year+1900, $month+1, $day);
 
     Vhffs::Functions::create_dir( $directory ) if( ! -d $directory );
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/