[Rt-commit] rt branch, master, updated. rt-4.0.8-589-gdffb067

Alex Vandiver alexmv at bestpractical.com
Mon Nov 26 21:04:44 EST 2012


The branch, master has been updated
       via  dffb067208d98b7063cece4d02c0fc22f22497b8 (commit)
       via  1ed810ca43a7c8b10ed53d48ed5c2901af2920ab (commit)
       via  e9b8914a3a7be465a177465b239087e0c45f356d (commit)
       via  529fa7a722867474d31745710fb6935b8abee54e (commit)
       via  fcab7d5f79f09bfaca34c3c5ad787e132053dbfb (commit)
       via  b71b6d9bf0070248a8158681116b417e12241ac8 (commit)
       via  1a8944fef8189bcad27dfb8e44c03ec0d2b66c30 (commit)
       via  ffd6a9079c17e6f5f49fef45257f8326274afbe1 (commit)
       via  b15e9151e0feabe4056db44fbed67126df2581ab (commit)
       via  4e9ad32f48f8aefad04534bc3fd3098aff3bfe4e (commit)
       via  e75066b67b1e25c1370caa874eaae0d3342fe76e (commit)
       via  015073f001694fff0b3dd88d4bf94f0da3d3be00 (commit)
       via  0f2377594daaea94181d8a641cc204079bf7e9de (commit)
       via  796efa1f820007e0ae55c84962e1aaf92c05ef4c (commit)
       via  a17e93d19174a345ec565ed9965c4be631933836 (commit)
       via  87dd08b37d1e03cb025745f5d7a9e51b94a85df3 (commit)
       via  71f52063b3819dede3eafcabd79d24dddb2c10ea (commit)
      from  723c76d6f819916892a61ccb523b702636fea10c (commit)

Summary of changes:
 Makefile.in                              |   3 -
 devel/tools/factory                      | 373 -------------------------------
 docs/UPGRADING-4.2                       |   4 +
 etc/RT_Config.pm.in                      |  24 --
 lib/RT/Attachment.pm                     |  71 ------
 lib/RT/Config.pm                         |  46 +---
 lib/RT/CustomFieldValue.pm               |  31 ---
 lib/RT/CustomFields.pm                   |  36 +--
 lib/RT/Interface/Email.pm                |   7 -
 lib/RT/Interface/Web.pm                  |  22 +-
 lib/RT/Principal.pm                      |   9 +-
 lib/RT/Record.pm                         |  46 ++--
 lib/RT/SavedSearches.pm                  |   9 -
 lib/RT/Ticket.pm                         | 247 +++-----------------
 lib/RT/Transaction.pm                    |  24 +-
 share/html/Admin/CustomFields/index.html |   6 -
 share/html/Elements/MyReminders          |   1 -
 share/html/Elements/MyRequests           |  49 ----
 share/html/Elements/MyTickets            |  49 ----
 t/customfields/transaction.t             |  17 +-
 t/ticket/linking.t                       |  35 ++-
 21 files changed, 103 insertions(+), 1006 deletions(-)
 delete mode 100755 devel/tools/factory
 delete mode 100644 share/html/Elements/MyRequests
 delete mode 100644 share/html/Elements/MyTickets

- Log -----------------------------------------------------------------
commit dffb067208d98b7063cece4d02c0fc22f22497b8
Merge: 723c76d 1ed810c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 26 21:02:52 2012 -0500

    Merge branch '4.2/remove-deprecations'
    
    Conflicts:
    	devel/tools/factory
    	docs/UPGRADING-4.2
    	etc/RT_Config.pm.in
    	lib/RT/Config.pm
    	lib/RT/Ticket.pm

diff --cc docs/UPGRADING-4.2
index ed52460,322c483..6ad8105
--- a/docs/UPGRADING-4.2
+++ b/docs/UPGRADING-4.2
@@@ -5,8 -5,6 +5,12 @@@ UPGRADING FROM RT 4.0.0 and greate
    but an informational notice will be issued on server start telling you about
    the rename.  To avoid this you should set $LogToSTDERR instead.
  
 +* The link direction and type maps are consolidated into RT::Link.  If you
 +  wrote local customizations or extensions utilizing %RT::Ticket::LINKDIRMAP,
 +  %RT::Ticket::LINKTYPEMAP, RT::Ticket->LINKDIRMAP, RT::Ticket->LINKTYPEMAP, or
 +  %RT::Record::LINKDIRMAP, you will need to switch to %RT::Link::DIRMAP and
 +  %RT::Link::TYPEMAP.
++
+ * $LinkTransactionsRun1Scrip is removed.  If you were relying on this behaviour
+   (by setting it to 1), you should adjust your scrips to ignore one of the link
+   transactions.
diff --cc etc/RT_Config.pm.in
index 0a5b761,abd7606..9d26fd5
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@@ -2733,30 -2678,4 +2733,6 @@@ Set($StatementLog, undef)
  
  =back
  
- 
- 
- 
- =head1 Deprecated options
- 
- =over 4
- 
- =item C<$LinkTransactionsRun1Scrip>
- 
- RT-3.4 backward compatibility setting. Add/Delete Link used to record
- one transaction and run one scrip. Set this value to 1 if you want
- only one of the link transactions to have scrips run.
- 
- =cut
- 
- Set($LinkTransactionsRun1Scrip, 0);
- 
- =item C<$ResolveDefaultUpdateType>
- 
- This option has been deprecated.  You can configure this site-wide
- with L</Lifecycles> (see L</Labeling and defining actions>).
- 
- =back
- 
 +=cut
 +
  1;
diff --cc lib/RT/Config.pm
index 71aee3b,24f1b23..723d753
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@@ -791,60 -760,6 +773,34 @@@ our %META = 
                  if $self->Meta('LogToScreen')->{'Source'}{'Package'};
          },
      },
-     ActiveStatus => {
-         Type => 'ARRAY',
-         PostLoadCheck => sub {
-             my $self  = shift;
-             return unless shift;
-             # XXX Remove in RT 4.2
-             warn <<EOT;
- The ActiveStatus configuration has been replaced by the new Lifecycles
- functionality. You should set the 'active' property of the 'default'
- lifecycle and add transition rules; see RT_Config.pm for documentation.
- EOT
-         },
-     },
-     InactiveStatus => {
-         Type => 'ARRAY',
-         PostLoadCheck => sub {
-             my $self  = shift;
-             return unless shift;
-             # XXX Remove in RT 4.2
-             warn <<EOT;
- The InactiveStatus configuration has been replaced by the new Lifecycles
- functionality. You should set the 'inactive' property of the 'default'
- lifecycle and add transition rules; see RT_Config.pm for documentation.
- EOT
-         },
-     },
 +    CustomFieldGroupings => {
 +        Type            => 'HASH',
 +        PostLoadCheck   => sub {
 +            my $config = shift;
 +            # use scalar context intentionally to avoid not a hash error
 +            my $groups = $config->Get('CustomFieldGroupings') || {};
 +
 +            unless (ref($groups) eq 'HASH') {
 +                RT->Logger->error("Config option \%CustomFieldGroupings is a @{[ref $groups]} not a HASH; ignoring");
 +                $groups = {};
 +            }
 +
 +            for my $class (keys %$groups) {
 +                unless (ref($groups->{$class}) eq 'HASH') {
 +                    RT->Logger->error("Config option \%CustomFieldGroupings{$class} is not a HASH; ignoring");
 +                    delete $groups->{$class};
 +                    next;
 +                }
 +                for my $group (keys %{ $groups->{$class} }) {
 +                    unless (ref($groups->{$class}{$group}) eq 'ARRAY') {
 +                        RT->Logger->error("Config option \%CustomFieldGroupings{$class}{$group} is not an ARRAY; ignoring");
 +                        delete $groups->{$class}{$group};
 +                    }
 +                }
 +            }
 +            $config->Set( CustomFieldGroupings => %$groups );
 +        },
 +    },
  );
  my %OPTIONS = ();
  
diff --cc lib/RT/Record.pm
index 21905a3,2be9ec9..aed6136
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@@ -1314,49 -1310,20 +1296,48 @@@ sub _AddLink 
  
      unless ($linkid) {
          $RT::Logger->error("Link could not be created: ".$linkmsg);
 -        return ( 0, $self->loc("Link could not be created") );
 +        return ( 0, $self->loc("Link could not be created: [_1]", $linkmsg) );
      }
  
 -    my $basetext = $self->FormatLink(Object => $link->BaseObj,
 -				     FallBack => $args{Base});
 -    my $targettext = $self->FormatLink(Object => $link->TargetObj,
 -				       FallBack => $args{Target});
 +    my $basetext = $self->FormatLink(Object   => $link->BaseObj,
 +                                     FallBack => $args{Base});
 +    my $targettext = $self->FormatLink(Object   => $link->TargetObj,
 +                                       FallBack => $args{Target});
      my $typetext = $self->FormatType(Type => $args{Type});
 -    my $TransString =
 -      "$basetext $typetext $targettext.";
 -    return ( $linkid, $TransString ) ;
 -}
 +    my $TransString = "$basetext $typetext $targettext.";
  
 +    # No transactions for you!
 +    return ($linkid, $TransString) if $args{'Silent'};
  
 +    # Some transactions?
 +    my $remote_uri = RT::URI->new( $self->CurrentUser );
 +    $remote_uri->FromURI( $remote_link );
 +
 +    my $opposite_direction = $direction eq 'Target' ? 'Base': 'Target';
 +
 +    unless ( $args{ 'Silent'. $direction } ) {
 +        my ( $Trans, $Msg, $TransObj ) = $self->_NewTransaction(
 +            Type      => 'AddLink',
 +            Field     => $RT::Link::DIRMAP{$args{'Type'}}->{$direction},
 +            NewValue  => $remote_uri->URI || $remote_link,
 +            TimeTaken => 0
 +        );
 +        $RT::Logger->error("Couldn't create transaction: $Msg") unless $Trans;
 +    }
 +
 +    if ( !$args{"Silent$opposite_direction"} && $remote_uri->IsLocal ) {
 +        my $OtherObj = $remote_uri->Object;
 +        my ( $val, $msg ) = $OtherObj->_NewTransaction(
 +            Type           => 'AddLink',
 +            Field          => $RT::Link::DIRMAP{$args{'Type'}}->{$opposite_direction},
 +            NewValue       => $self->URI,
-             ActivateScrips => !RT->Config->Get('LinkTransactionsRun1Scrip'),
 +            TimeTaken      => 0,
 +        );
 +        $RT::Logger->error("Couldn't create transaction: $msg") unless $val;
 +    }
 +
 +    return ($linkid, $TransString);
 +}
  
  =head2 _DeleteLink
  
@@@ -1406,98 -1368,34 +1387,97 @@@ sub _DeleteLink 
      }
  
      my $link = RT::Link->new( $self->CurrentUser );
 -    $RT::Logger->debug( "Trying to load link: " . $args{'Base'} . " " . $args{'Type'} . " " . $args{'Target'} );
 -
 +    $RT::Logger->debug( "Trying to load link: "
 +            . $args{'Base'} . " "
 +            . $args{'Type'} . " "
 +            . $args{'Target'} );
 +
 +    $link->LoadByParams(
 +        Base   => $args{'Base'},
 +        Type   => $args{'Type'},
 +        Target => $args{'Target'}
 +    );
  
 -    $link->LoadByParams( Base=> $args{'Base'}, Type=> $args{'Type'}, Target=>  $args{'Target'} );
 -    #it's a real link. 
 +    unless ($link->id) {
 +        $RT::Logger->debug("Couldn't find that link");
 +        return ( 0, $self->loc("Link not found") );
 +    }
  
 -    if ( $link->id ) {
 -        my $basetext = $self->FormatLink(Object => $link->BaseObj,
 +    my $basetext = $self->FormatLink(Object   => $link->BaseObj,
                                       FallBack => $args{Base});
 -        my $targettext = $self->FormatLink(Object => $link->TargetObj,
 +    my $targettext = $self->FormatLink(Object   => $link->TargetObj,
                                         FallBack => $args{Target});
 -        my $typetext = $self->FormatType(Type => $args{Type});
 -        my $linkid = $link->id;
 -        $link->Delete();
 -        my $TransString = "$basetext no longer $typetext $targettext.";
 -        return ( 1, $TransString);
 +    my $typetext = $self->FormatType(Type => $args{Type});
 +    my $TransString = "$basetext no longer $typetext $targettext.";
 +
 +    my ($ok, $msg) = $link->Delete();
 +    unless ($ok) {
 +        RT->Logger->error("Link could not be deleted: $msg");
 +        return ( 0, $self->loc("Link could not be deleted: [_1]", $msg) );
      }
  
 -    #if it's not a link we can find
 -    else {
 -        $RT::Logger->debug("Couldn't find that link");
 -        return ( 0, $self->loc("Link not found") );
 +    # No transactions for you!
 +    return (1, $TransString) if $args{'Silent'};
 +
 +    # Some transactions?
 +    my $remote_uri = RT::URI->new( $self->CurrentUser );
 +    $remote_uri->FromURI( $remote_link );
 +
 +    my $opposite_direction = $direction eq 'Target' ? 'Base': 'Target';
 +
 +    unless ( $args{ 'Silent'. $direction } ) {
 +        my ( $Trans, $Msg, $TransObj ) = $self->_NewTransaction(
 +            Type      => 'DeleteLink',
 +            Field     => $RT::Link::DIRMAP{$args{'Type'}}->{$direction},
 +            OldValue  => $remote_uri->URI || $remote_link,
 +            TimeTaken => 0
 +        );
 +        $RT::Logger->error("Couldn't create transaction: $Msg") unless $Trans;
      }
 +
 +    if ( !$args{"Silent$opposite_direction"} && $remote_uri->IsLocal ) {
 +        my $OtherObj = $remote_uri->Object;
 +        my ( $val, $msg ) = $OtherObj->_NewTransaction(
 +            Type           => 'DeleteLink',
 +            Field          => $RT::Link::DIRMAP{$args{'Type'}}->{$opposite_direction},
 +            OldValue       => $self->URI,
-             ActivateScrips => !RT->Config->Get('LinkTransactionsRun1Scrip'),
 +            TimeTaken      => 0,
 +        );
 +        $RT::Logger->error("Couldn't create transaction: $msg") unless $val;
 +    }
 +
 +    return (1, $TransString);
  }
  
 +=head1 LockForUpdate
  
 +In a database transaction, gains an exclusive lock on the row, to
 +prevent race conditions.  On SQLite, this is a "RESERVED" lock on the
 +entire database.
  
 +=cut
  
 +sub LockForUpdate {
 +    my $self = shift;
 +
 +    my $pk = $self->_PrimaryKey;
 +    my $id = @_ ? $_[0] : $self->$pk;
 +    $self->_expire if $self->isa("DBIx::SearchBuilder::Record::Cachable");
 +    if (RT->Config->Get('DatabaseType') eq "SQLite") {
 +        # SQLite does DB-level locking, upgrading the transaction to
 +        # "RESERVED" on the first UPDATE/INSERT/DELETE.  Do a no-op
 +        # UPDATE to force the upgade.
 +        return RT->DatabaseHandle->dbh->do(
 +            "UPDATE " .$self->Table.
 +                " SET $pk = $pk WHERE 1 = 0");
 +    } else {
 +        return $self->_LoadFromSQL(
 +            "SELECT * FROM ".$self->Table
 +                ." WHERE $pk = ? FOR UPDATE",
 +            $id,
 +        );
 +    }
 +}
  
  =head2 _NewTransaction  PARAMHASH
  
diff --cc share/html/Elements/MyReminders
index 2de4b53,5e29067..5e29067
mode 100644,100755..100644
--- a/share/html/Elements/MyReminders
+++ b/share/html/Elements/MyReminders

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


More information about the Rt-commit mailing list