add -t flag to bulk void for payment type, RT#73413
[freeside.git] / htetc / handler.pl
index d7c5657..2fe5d37 100644 (file)
@@ -6,12 +6,31 @@ use strict;
 use warnings;
 use FS::Mason qw( mason_interps );
 use FS::Trace;
+use FS::access_user_log;
+use FS::Conf;
+
+$FS::Conf::conf_cache_enabled = 1; # enable FS::Conf caching for performance
+
+# Preload to share in mod_perl parent for performance
+use FS::UID qw(load_schema);
+load_schema();
+use FS::Record qw(fk_methods_init);
+fk_methods_init;
 
 if ( %%%RT_ENABLED%%% ) {
+
   require RT;
+
   $> = scalar(getpwnam('freeside'));
+
   RT::LoadConfig();
   RT::Init();
+
+  # disconnect DB before fork:
+  #   (avoid 'prepared statement "dbdpg_p\d+_\d+" already exists' errors?)
+  $RT::Handle->dbh(undef);
+  undef $RT::Handle;
+
   $> = $<;
 }
 
@@ -47,6 +66,8 @@ sub handler
     #($r) = @_;
     my $r = shift;
 
+    my $start_time = time;
+
     FS::Trace->log('protecting fds');
 
     #from rt/bin/webmux.pl(.in)
@@ -95,7 +116,6 @@ sub handler
       return -1 if defined( $r->content_type )
                 && $r->content_type !~ m!(^text/|\bxml\b)!io;
 
-
       local $SIG{__WARN__};
       local $SIG{__DIE__};
 
@@ -147,6 +167,8 @@ sub handler
 #       );
 #    }
 
+    FS::access_user_log->insert_new_path( $r->filename, time-$start_time );
+
     FS::Trace->log('done');
 
     FS::Trace->dumpfile( "%%%FREESIDE_EXPORT%%%/profile/$$.".time,