[Rt-commit] rt branch, 4.0/upgrade-articles-acl-workaround, created. rt-4.0.1rc1-4-g9cce23c

Kevin Falcone falcone at bestpractical.com
Wed May 25 16:58:18 EDT 2011


The branch, 4.0/upgrade-articles-acl-workaround has been created
        at  9cce23cb5b9bcc9464fbc94daa701bc39a1301c4 (commit)

- Log -----------------------------------------------------------------
commit 9cce23cb5b9bcc9464fbc94daa701bc39a1301c4
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed May 25 16:44:22 2011 -0400

    Work around Transaction.pm trying to load an RT::FM::Article
    
    If you have CustomField Transactions related to your RT::FM::Article,
    Next will try to call Type which results in RT trying to load
    RT::FM::Article and blowing up without completing the upgrade.

diff --git a/etc/upgrade/upgrade-articles.in b/etc/upgrade/upgrade-articles.in
index 0fcac77..ee41f20 100644
--- a/etc/upgrade/upgrade-articles.in
+++ b/etc/upgrade/upgrade-articles.in
@@ -227,12 +227,19 @@ sub copy_tables {
 { # update Transactions
   # we only keep article transactions at this point
     use RT::Transactions;
+    # Next calls Type to check readability and Type calls _Accessible
+    # which called CurrentUserCanSee which calls Object which tries to instantiate
+    # an RT::FM::Article.  Rather than a shim RT::FM::Article class, I'm just avoiding
+    # the ACL check since we're running around as the superuser.
+    {
+    local *RT::Transaction::Type = sub { shift->__Value('Type') };
     my $transactions = RT::Transactions->new(RT->SystemUser);
     $transactions->Limit( FIELD => 'ObjectType', VALUE => 'RT::FM::Article' );
     while ( my $t = $transactions->Next ) {
         my ($ret, $msg) = $t->__Set( Field => 'ObjectType', Value => 'RT::Article' );
         warn "Updated Transaction ".$t->Id." to point to RT::Article";
     }
+    }
 
     # we also need to change links that point to articles
     $transactions = RT::Transactions->new(RT->SystemUser);

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


More information about the Rt-commit mailing list