2 # $Id: whackatch.tcl 1266 2009-07-14 18:39:12Z hubert@u.washington.edu $
3 # ========================================================================
4 # Copyright 2006 University of Washington
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # ========================================================================
16 # Purpose: CGI script to cleanup requested attachment
19 # ext - attachment file extension
24 # inherit global config
27 # seconds to pause before rechecking for abandanded attachment files
31 if {[gets stdin ext
] >= 0 && [regexp {^
[A-Za-z0-9
\-]+$} $ext ext
] == 1} {
33 set towhack
[file join $_wp(fileroot
) $_wp(detachpath
) detach.
${ext
}]
36 set timein
[clock seconds
]
38 after [expr {$abandoned * 1000}]
40 if {[catch {file atime
$towhack} atime
] ||
($timein - $atime) > $abandoned} {
45 catch {exec /bin
/rm
-f $towhack}