X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT.pm;h=4372a564d4131ed921233ea241fdfd85f36365db;hb=a72a10f754f7465121d6137bb3dcee0a21ea6443;hp=ec2e6cc9712b3370166b2d8ce64ee59197a88265;hpb=43a06151e47d2c59b833cbd8c26d97865ee850b6;p=freeside.git diff --git a/rt/lib/RT.pm b/rt/lib/RT.pm index ec2e6cc97..4372a564d 100644 --- a/rt/lib/RT.pm +++ b/rt/lib/RT.pm @@ -319,6 +319,7 @@ sub InitLogging { sub InitSignalHandlers { my %arg = @_; + return if $arg{'NoSignalHandlers'}; # Signal handlers ## This is the default handling of warnings and die'ings in the code @@ -326,32 +327,28 @@ sub InitSignalHandlers { ## Mason). It will log all problems through the standard logging ## mechanism (see above). - unless ( $arg{'NoSignalHandlers'} ) { - - $SIG{__WARN__} = sub { - # The 'wide character' warnings has to be silenced for now, at least - # until HTML::Mason offers a sane way to process both raw output and - # unicode strings. - # use 'goto &foo' syntax to hide ANON sub from stack - if( index($_[0], 'Wide character in ') != 0 ) { - unshift @_, $RT::Logger, qw(level warning message); - goto &Log::Dispatch::log; - } - }; - - #When we call die, trap it and log->crit with the value of the die. + $SIG{__WARN__} = sub { + # The 'wide character' warnings has to be silenced for now, at least + # until HTML::Mason offers a sane way to process both raw output and + # unicode strings. + # use 'goto &foo' syntax to hide ANON sub from stack + if( index($_[0], 'Wide character in ') != 0 ) { + unshift @_, $RT::Logger, qw(level warning message); + goto &Log::Dispatch::log; + } + }; - $SIG{__DIE__} = sub { - # if we are not in eval and perl is not parsing code - # then rollback transactions and log RT error - unless ($^S || !defined $^S ) { - $RT::Handle->Rollback(1) if $RT::Handle; - $RT::Logger->crit("$_[0]") if $RT::Logger; - } - die $_[0]; - }; +#When we call die, trap it and log->crit with the value of the die. - } + $SIG{__DIE__} = sub { + # if we are not in eval and perl is not parsing code + # then rollback transactions and log RT error + unless ($^S || !defined $^S ) { + $RT::Handle->Rollback(1) if $RT::Handle; + $RT::Logger->crit("$_[0]") if $RT::Logger; + } + die $_[0]; + }; } @@ -425,6 +422,7 @@ sub InitClasses { require RT::Approval; require RT::Lifecycle; require RT::Link; + require RT::Links; require RT::Article; require RT::Articles; require RT::Class; @@ -688,11 +686,21 @@ sub InitPlugins { sub InstallMode { my $self = shift; if (@_) { - $_INSTALL_MODE = shift; - if($_INSTALL_MODE) { - require RT::CurrentUser; - $SystemUser = RT::CurrentUser->new(); - } + my ($integrity, $state, $msg) = RT::Handle->CheckIntegrity; + if ($_[0] and $integrity) { + # Trying to turn install mode on but we have a good DB! + require Carp; + $RT::Logger->error( + Carp::longmess("Something tried to turn on InstallMode but we have DB integrity!") + ); + } + else { + $_INSTALL_MODE = shift; + if($_INSTALL_MODE) { + require RT::CurrentUser; + $SystemUser = RT::CurrentUser->new(); + } + } } return $_INSTALL_MODE; } @@ -745,7 +753,7 @@ sub CanonicalizeGeneratedPaths { =head2 AddJavaScript helper method to add js files to C config. -to add extra css files, you can add the following line +to add extra js files, you can add the following line in the plugin's main file: RT->AddJavaScript( 'foo.js', 'bar.js' );