[Rt-commit] rt branch, 3.999-trunk, updated. f122c8db89b7aedbddf47471c5efcde8b6b4fbaf

clkao at bestpractical.com clkao at bestpractical.com
Sat Oct 24 01:49:32 EDT 2009


The branch, 3.999-trunk has been updated
       via  f122c8db89b7aedbddf47471c5efcde8b6b4fbaf (commit)
       via  a9239391d5553b113c66f88f74b125ccb8d21077 (commit)
       via  71cffdfc899a84da8605be9f00cc56d4466f663c (commit)
       via  3d0d60c940ab88e692d99b4460981a545026ce63 (commit)
       via  0fc8d9f27df81529bd967f66a9e41247d3bc2c20 (commit)
      from  21322e26734dd1ba5f4998ef5a7bb3cec16e0feb (commit)

Summary of changes:
 Makefile.PL                       |    2 +-
 lib/RT/Bootstrap.pm               |    4 ----
 lib/RT/Interface/Web/Handler.pm   |    8 +++++---
 lib/RT/Model/Transaction.pm       |   11 ++++++-----
 lib/RT/Test.pm                    |    2 --
 t/ticket/cfsort-freeform-single.t |    2 +-
 6 files changed, 13 insertions(+), 16 deletions(-)

- Log -----------------------------------------------------------------
commit 0fc8d9f27df81529bd967f66a9e41247d3bc2c20
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Sat Oct 24 09:43:23 2009 +0800

    During bootstrap, flush cache only if the record_base_class supports so.

diff --git a/lib/RT/Bootstrap.pm b/lib/RT/Bootstrap.pm
index db71f33..759a09d 100644
--- a/lib/RT/Bootstrap.pm
+++ b/lib/RT/Bootstrap.pm
@@ -101,7 +101,8 @@ sub insert_initial_data {
         }
     }
 
-    Jifty::DBI::Record::Cachable->flush_cache;
+    my $record_base_class = Jifty->config->framework('Database')->{'RecordBaseClass'};
+    $record_base_class->flush_cache if $record_base_class->can("flush_cache");
 
     # grant SuperUser right to system user
     {
@@ -122,7 +123,7 @@ sub insert_initial_data {
         }
     }
 
-    Jifty::DBI::Record::Cachable->flush_cache;
+    $record_base_class->flush_cache if $record_base_class->can("flush_cache");
 
     # system groups
     foreach my $name (qw(Everyone Privileged Unprivileged)) {

commit 3d0d60c940ab88e692d99b4460981a545026ce63
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Sat Oct 24 12:05:15 2009 +0800

    Depend on new Jifty::DBI to do the cache flushing required after rollback.  Also use more correct api to invoke flush from interface::web::handler.

diff --git a/Makefile.PL b/Makefile.PL
index 69c2150..d905ab5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -10,7 +10,7 @@ requires(
     'Digest::MD5'                => '2.27',
     'DBI'                        => '1.37',
     'Class::ReturnValue'         => '0.40',
-    'Jifty::DBI'                 => '0.49',
+    'Jifty::DBI'                 => '0.59',
     'Text::Template'             => 0,
     'File::ShareDir'             => 0,
     'File::Spec'                 => '0.8',
diff --git a/lib/RT/Bootstrap.pm b/lib/RT/Bootstrap.pm
index 759a09d..9930a2c 100644
--- a/lib/RT/Bootstrap.pm
+++ b/lib/RT/Bootstrap.pm
@@ -101,9 +101,6 @@ sub insert_initial_data {
         }
     }
 
-    my $record_base_class = Jifty->config->framework('Database')->{'RecordBaseClass'};
-    $record_base_class->flush_cache if $record_base_class->can("flush_cache");
-
     # grant SuperUser right to system user
     {
         my $test_ace = RT::Model::ACE->new( current_user => RT->system_user );
@@ -123,8 +120,6 @@ sub insert_initial_data {
         }
     }
 
-    $record_base_class->flush_cache if $record_base_class->can("flush_cache");
-
     # system groups
     foreach my $name (qw(Everyone Privileged Unprivileged)) {
         my $group = RT::Model::Group->new( current_user => RT->system_user );
diff --git a/lib/RT/Interface/Web/Handler.pm b/lib/RT/Interface/Web/Handler.pm
index c95ce92..720ee24 100644
--- a/lib/RT/Interface/Web/Handler.pm
+++ b/lib/RT/Interface/Web/Handler.pm
@@ -88,9 +88,11 @@ sub cleanup_request {
     # Clean out the ACL cache. the performance impact should be marginal.
     # Consistency is imprived, too.
     RT::Model::Principal->invalidate_acl_cache();
-    Jifty::DBI::Record::Cachable->flush_cache
-        if ( RT->config->get('web_flush_db_cache_every_request')
-        and UNIVERSAL::can( 'Jifty::DBI::Record::Cachable' => 'flush_cache' ) );
+
+    my $record_base_class = Jifty->config->framework('Database')->{'RecordBaseClass'};
+    $record_base_class->flush_cache
+        if $record_base_class->can("flush_cache") &&
+           RT->config->get('web_flush_db_cache_every_request');
 
     # cleanup global squelching of the mails
     require RT::ScripAction::SendEmail;
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index dbb4f8e..d3649cc 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -418,8 +418,6 @@ sub run_mailgate {
     }
     $cmd .= ' 2>&1';
 
-    Jifty::DBI::Record::Cachable->flush_cache;
-
     require IPC::Open2;
     my ( $child_out, $child_in );
     my $pid = IPC::Open2::open2( $child_out, $child_in, $cmd );

commit 71cffdfc899a84da8605be9f00cc56d4466f663c
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Sat Oct 24 12:39:06 2009 +0800

    Don't load transaction again after create. RT::Record does that for us already.

diff --git a/lib/RT/Model/Transaction.pm b/lib/RT/Model/Transaction.pm
index 592f999..7fe9c15 100755
--- a/lib/RT/Model/Transaction.pm
+++ b/lib/RT/Model/Transaction.pm
@@ -361,7 +361,6 @@ sub create {
     my $mime = delete $args{'mime_obj'};
 
     my $id = $self->SUPER::create( %args );
-    $self->load($id);
 
     if ( defined $mime ) {
         my ( $id, $msg ) = $self->_attach( $mime );

commit a9239391d5553b113c66f88f74b125ccb8d21077
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Sat Oct 24 13:26:01 2009 +0800

    In transaction hook, escalate the transaction object and use ticket from it, instead of escalating ticket object only.

diff --git a/lib/RT/Model/Transaction.pm b/lib/RT/Model/Transaction.pm
index 7fe9c15..1d8dbe6 100755
--- a/lib/RT/Model/Transaction.pm
+++ b/lib/RT/Model/Transaction.pm
@@ -374,13 +374,15 @@ sub create {
     Jifty->log->debug( 'About to think about scrips for transaction #' . $self->id );
     if ( $activate_scrips and $args{'object_type'} eq 'RT::Model::Ticket' ) {
         # Entry point of the rule system
-        my $ticket = RT::Model::Ticket->new( current_user => RT::CurrentUser->superuser );
-        $ticket->load( $args{'object_id'} );
+        # Escalate as superuser
+        my $txn = RT::Model::Transaction->new( current_user => RT::CurrentUser->superuser );
+        $txn->load( $self->id );
+
         $self->{'active_rules'} = RT::Ruleset->find_all_rules(
             stage          => 'transaction_create',
             type           => $args{'type'},
-            ticket_obj      => $ticket,
-            transaction_obj => $self,
+            ticket_obj      => $txn->ticket,
+            transaction_obj => $txn,
         );
         if ( $commit_scrips ) {
             Jifty->log->debug( 'About to commit scrips for transaction #' . $self->id );

commit f122c8db89b7aedbddf47471c5efcde8b6b4fbaf
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Sat Oct 24 13:49:11 2009 +0800

    silent a test warning caused by empty column passed to order_by

diff --git a/t/ticket/cfsort-freeform-single.t b/t/ticket/cfsort-freeform-single.t
index 6e85856..39ef591 100644
--- a/t/ticket/cfsort-freeform-single.t
+++ b/t/ticket/cfsort-freeform-single.t
@@ -85,7 +85,7 @@ sub run_tests {
             my $error = 0;
             my $tix = RT::Model::TicketCollection->new(current_user => RT->system_user );
             $tix->from_sql( $query );
-            $tix->order_by( column => $test->{'Order'}, order => $order );
+            $tix->order_by( column => $test->{'order'}, order => $order );
 
             ok($tix->count, "found ticket(s)")
                 or $error = 1;

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


More information about the Rt-commit mailing list