[rt-devel] Disable all scrips in a script

Emmanuel Lacour elacour at easter-eggs.com
Wed Dec 10 09:24:19 EST 2014


On Wed, Dec 10, 2014 at 12:11:24PM +0100, Emmanuel Lacour wrote:
> 
> Dear RT hackers,
> 
> does anyone know how to disable all scrips inside a script, only for this script
> (such as a bulk insert script) ?
> 
> this must not affect running RT, only API calls inside this script.
> 
> 

This seems to works (I also disable Lifecycle checking because I'm doing
a batch import of old tickets from another app):

# Disable lifecycle transition checking
use RT::Lifecycle;
*RT::Lifecycle::IsValid = sub {
        return 1;
};
*RT::Lifecycle::IsTransition = sub {
        return 1;
};

# Disable scrips
use RT::Transaction;
my $old_create = \&RT::Transaction::Create;
*RT::Transaction::Create = sub {
        my $self = shift;
        my %args = @_;
        $args{ActivateScrips} = 0;
        return $old_create->($self, %args);
};


-- 
Easter-eggs                              Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37    -   Fax: +33 (0) 1 43 35 00 76
mailto:elacour at easter-eggs.com  -   http://www.easter-eggs.com


More information about the rt-devel mailing list