[Rt-commit] [svn] r1975 - in rt/branches/3.3-TESTING: . bin lib/RT/Interface/Web

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Thu Dec 9 02:05:52 EST 2004


Author: jesse
Date: Thu Dec  9 02:05:51 2004
New Revision: 1975

Modified:
   rt/branches/3.3-TESTING/   (props changed)
   rt/branches/3.3-TESTING/bin/mason_handler.fcgi.in
   rt/branches/3.3-TESTING/bin/mason_handler.scgi.in
   rt/branches/3.3-TESTING/bin/mason_handler.svc.in
   rt/branches/3.3-TESTING/bin/standalone_httpd.in
   rt/branches/3.3-TESTING/bin/webmux.pl.in
   rt/branches/3.3-TESTING/lib/RT/Interface/Web/Handler.pm
Log:
 r1980 at hualien:  jesse | 2004-12-09T07:05:41.787599Z
 Refactored post-http handling code into lib/RT/Interface/Web/Handler.pm 
 
 


Modified: rt/branches/3.3-TESTING/bin/mason_handler.fcgi.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/mason_handler.fcgi.in	(original)
+++ rt/branches/3.3-TESTING/bin/mason_handler.fcgi.in	Thu Dec  9 02:05:51 2004
@@ -76,13 +76,7 @@
     if ($@) {
         $RT::Logger->crit($@);
     }
-
-
-    if ($RT::Handle->TransactionDepth) {
-        $RT::Handle->ForceRollback;
-        $RT::Logger->crit("Transaction not committed. Usually indicates a software fault. Data loss may have occurred") ;
-    }
-
+    RT::Interface::Web::Handler->CleanupRequest(); 
 
 }
 

Modified: rt/branches/3.3-TESTING/bin/mason_handler.scgi.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/mason_handler.scgi.in	(original)
+++ rt/branches/3.3-TESTING/bin/mason_handler.scgi.in	Thu Dec  9 02:05:51 2004
@@ -61,5 +61,5 @@
 }
 
 $Handler->handle_cgi_object($cgi);
-
+RT::Interface::Web::Handler->CleanupRequest();
 1;

Modified: rt/branches/3.3-TESTING/bin/mason_handler.svc.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/mason_handler.svc.in	(original)
+++ rt/branches/3.3-TESTING/bin/mason_handler.svc.in	Thu Dec  9 02:05:51 2004
@@ -236,6 +236,7 @@
     warn "Serving $comp\n";
 
     $Handler->handle_cgi($comp);
+    RT::Interface::Web::Handler->CleanupRequest();
     # _should_ always be tied
 }
 

Modified: rt/branches/3.3-TESTING/bin/standalone_httpd.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/standalone_httpd.in	(original)
+++ rt/branches/3.3-TESTING/bin/standalone_httpd.in	Thu Dec  9 02:05:51 2004
@@ -150,21 +150,7 @@
             eval { $Handler->handle_cgi_object($cgi); };
             $RT::Logger->crit($@) if ($@);
 
-            if ( $RT::Handle->TransactionDepth ) {
-                $RT::Handle->ForceRollback;
-                $RT::Logger->crit( "Transaction not committed. Usually indicates a software fault. Data loss may have occurred");
-            }
-
-	    # Let's clear out RT's ACL cache. The perf impact should
-	    # be marginal and the consistency is a good thing.
-	    RT::Principal->InvalidateACLCache();
-            DBIx::SearchBuilder::Record::Cachable->FlushCache
-              if (
-                $RT::WebFlushDbCacheEveryRequest
-                and UNIVERSAL::can(
-                    'DBIx::SearchBuilder::Record::Cachable' => 'FlushCache'
-                )
-              );
+	    RT::Interface::Web::Handler->CleanupRequest();
         }
 
     }

Modified: rt/branches/3.3-TESTING/bin/webmux.pl.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/webmux.pl.in	(original)
+++ rt/branches/3.3-TESTING/bin/webmux.pl.in	Thu Dec  9 02:05:51 2004
@@ -136,22 +136,7 @@
 
     undef(%session);
 
-    if ( $RT::Handle->TransactionDepth ) {
-        $RT::Handle->ForceRollback;
-        $RT::Logger->crit(
-"Transaction not committed. Usually indicates a software fault. Data loss may have occurred"
-        );
-    }
-    # Clean out the ACL cache. the performance impact should be marginal. 
-    # Consistency is imprived, too.
-    RT::Principal->InvalidateACLCache();
-    DBIx::SearchBuilder::Record::Cachable->FlushCache
-      if (
-        $RT::WebFlushDbCacheEveryRequest
-        and UNIVERSAL::can(
-            'DBIx::SearchBuilder::Record::Cachable' => 'FlushCache'
-        )
-      );
+    RT::Interface::Web::Handler->CleanupRequest();
 
     return $status;
 }

Modified: rt/branches/3.3-TESTING/lib/RT/Interface/Web/Handler.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Interface/Web/Handler.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Interface/Web/Handler.pm	Thu Dec  9 02:05:51 2004
@@ -178,6 +178,32 @@
     return($handler);
 }
 
+=head2 CleanupRequest
+
+Rollback any uncommitted transaction.
+Flush the ACL cache
+Flush the searchbuilder query cache
+
+=cut
+
+sub CleanupRequest {
+
+    if ( $RT::Handle->TransactionDepth ) {
+        $RT::Handle->ForceRollback;
+        $RT::Logger->crit(
+            "Transaction not committed. Usually indicates a software fault."
+            . "Data loss may have occurred" );
+    }
+
+    # Clean out the ACL cache. the performance impact should be marginal.
+    # Consistency is imprived, too.
+    RT::Principal->InvalidateACLCache();
+    DBIx::SearchBuilder::Record::Cachable->FlushCache
+      if ( $RT::WebFlushDbCacheEveryRequest
+        and UNIVERSAL::can(
+            'DBIx::SearchBuilder::Record::Cachable' => 'FlushCache' ) );
+
+}
 # }}}
 
 1;


More information about the Rt-commit mailing list