[Rt-commit] rt branch, 4.0/pg-session-last-updated-fix, created. rt-4.0.6-126-g8639892

? sunnavy sunnavy at bestpractical.com
Wed May 30 15:40:44 EDT 2012


The branch, 4.0/pg-session-last-updated-fix has been created
        at  863989237b1302bb89412fe4a64bff799c5c5c76 (commit)

- Log -----------------------------------------------------------------
commit 863989237b1302bb89412fe4a64bff799c5c5c76
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 31 03:31:35 2012 +0800

    update LastUpdated for Pg backend session, see #19715

diff --git a/lib/RT/Interface/Web/Session.pm b/lib/RT/Interface/Web/Session.pm
index c5b88f1..b8971b5 100644
--- a/lib/RT/Interface/Web/Session.pm
+++ b/lib/RT/Interface/Web/Session.pm
@@ -86,6 +86,26 @@ sub Class {
              || 'Apache::Session::File';
     eval "require $class";
     die $@ if $@;
+
+    if ( $class eq 'Apache::Session::Postgres' ) {
+        require Apache::Session::Store::Postgres;
+        *Apache::Session::Store::Postgres::update = sub {
+            Apache::Session::Store::DBI::update(@_);
+            my $self    = shift;
+            my $session = shift;
+            local $self->{dbh}->{RaiseError} = 1;
+            if ( !defined $self->{update_last_updated} ) {
+                $self->{update_sth} = $self->{dbh}->prepare_cached(
+                    qq{
+                UPDATE $self->{'table_name'} SET LastUpdated = NOW() WHERE id = ?}
+                );
+            }
+
+            $self->{update_sth}
+              ->bind_param( 1, $session->{data}->{_session_id} );
+            $self->{update_sth}->execute;
+        };
+    }
     return $class;
 }
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list