sub Init {
- my @arg = @_;
-
CheckPerlRequirements();
InitPluginPaths();
ConnectToDatabase();
InitSystemObjects();
InitClasses();
- InitLogging(@arg);
+ InitLogging();
InitPlugins();
RT::I18N->Init;
RT->Config->PostLoadCheck;
sub InitSignalHandlers {
my %arg = @_;
+ return if $arg{'NoSignalHandlers'};
# Signal handlers
## This is the default handling of warnings and die'ings in the code
## 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];
+ };
}
require RT::Approval;
require RT::Lifecycle;
require RT::Link;
+ require RT::Links;
require RT::Article;
require RT::Articles;
require RT::Class;
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;
}
=head2 AddJavaScript
helper method to add js files to C<JSFiles> 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' );