[Rt-commit] r6179 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Tue Oct 10 04:59:59 EDT 2006


Author: ruz
Date: Tue Oct 10 04:59:58 2006
New Revision: 6179

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm

Log:
 r3910 at cubic-pc:  cubic | 2006-09-29 11:50:28 +0400
 Shredder
 * add support for %t template in file names


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm	Tue Oct 10 04:59:58 2006
@@ -509,6 +509,8 @@
 
 * if C<FileName> has C<XXXX> (exactly four uppercase C<X> letters) then it would be changed with digits from 0000 to 9999 range, with first one free value;
 
+* if C<FileName> has C<%T> then it would be replaced with the current date and time in the C<YYYY-MM-DDTHH:MM:SS> format. Note that using C<%t> may still generate not unique names, using C<XXXX> recomended.
+
 * if C<FromStorage> argument is true (default behaviour) then result path would always be relative to C<StoragePath>;
 
 * if C<FromStorage> argument is false then result would be relative to the current dir unless it's allready absolute path.
@@ -542,10 +544,11 @@
     my %args = ( FileName => '', FromStorage => 1, @_ );
 
     # default value
-    my $file = $args{'FileName'};
-    unless( $file ) {
+    my $file = $args{'FileName'} || '%t-XXXX.sql';
+    if( $file =~ /\%t/i ) {
         require POSIX;
-        $file = POSIX::strftime( "%Y%m%dT%H%M%S-XXXX.sql", gmtime );
+        my $date_time = POSIX::strftime( "%Y%m%dT%H%M%S", gmtime );
+        $file =~ s/\%t/$date_time/gi;
     }
 
     # convert to absolute path


More information about the Rt-commit mailing list