Merge branch 'patch-1' of https://github.com/gjones2/Freeside
[freeside.git] / rt / lib / RT.pm
1 # BEGIN BPS TAGGED BLOCK {{{
2 #
3 # COPYRIGHT:
4 #
5 # This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
6 #                                          <sales@bestpractical.com>
7 #
8 # (Except where explicitly superseded by other copyright notices)
9 #
10 #
11 # LICENSE:
12 #
13 # This work is made available to you under the terms of Version 2 of
14 # the GNU General Public License. A copy of that license should have
15 # been provided with this software, but in any event can be snarfed
16 # from www.gnu.org.
17 #
18 # This work is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 # General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 # 02110-1301 or visit their web page on the internet at
27 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
28 #
29 #
30 # CONTRIBUTION SUBMISSION POLICY:
31 #
32 # (The following paragraph is not intended to limit the rights granted
33 # to you to modify and distribute this software under the terms of
34 # the GNU General Public License and is only of importance to you if
35 # you choose to contribute your changes and enhancements to the
36 # community by submitting them to Best Practical Solutions, LLC.)
37 #
38 # By intentionally submitting any modifications, corrections or
39 # derivatives to this work, or any other work intended for use with
40 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 # you are the copyright holder for those contributions and you grant
42 # Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
43 # royalty-free, perpetual, license to use, copy, create derivative
44 # works based on those contributions, and sublicense and distribute
45 # those contributions and any derivatives thereof.
46 #
47 # END BPS TAGGED BLOCK }}}
48
49 use strict;
50 use warnings;
51
52 package RT;
53
54
55 use File::Spec ();
56 use Cwd ();
57
58 use vars qw($Config $System $SystemUser $Nobody $Handle $Logger $_Privileged $_Unprivileged $_INSTALL_MODE);
59
60 use vars qw($BasePath
61  $EtcPath
62  $BinPath
63  $SbinPath
64  $VarPath
65  $LexiconPath
66  $PluginPath
67  $LocalPath
68  $LocalEtcPath
69  $LocalLibPath
70  $LocalLexiconPath
71  $LocalPluginPath
72  $MasonComponentRoot
73  $MasonLocalComponentRoot
74  $MasonDataDir
75  $MasonSessionDir);
76
77
78 RT->LoadGeneratedData();
79
80 =head1 NAME
81
82 RT - Request Tracker
83
84 =head1 SYNOPSIS
85
86 A fully featured request tracker package
87
88 =head1 DESCRIPTION
89
90 =head2 INITIALIZATION
91
92 =head2 LoadConfig
93
94 Load RT's config file.  First, the site configuration file
95 (F<RT_SiteConfig.pm>) is loaded, in order to establish overall site
96 settings like hostname and name of RT instance.  Then, the core
97 configuration file (F<RT_Config.pm>) is loaded to set fallback values
98 for all settings; it bases some values on settings from the site
99 configuration file.
100
101 In order for the core configuration to not override the site's
102 settings, the function C<Set> is used; it only sets values if they
103 have not been set already.
104
105 =cut
106
107 sub LoadConfig {
108     require RT::Config;
109     $Config = RT::Config->new;
110     $Config->LoadConfigs;
111     require RT::I18N;
112
113     # RT::Essentials mistakenly recommends that WebPath be set to '/'.
114     # If the user does that, do what they mean.
115     $RT::WebPath = '' if ($RT::WebPath eq '/');
116
117     # fix relative LogDir and GnuPG homedir
118     unless ( File::Spec->file_name_is_absolute( $Config->Get('LogDir') ) ) {
119         $Config->Set( LogDir =>
120               File::Spec->catfile( $BasePath, $Config->Get('LogDir') ) );
121     }
122
123     my $gpgopts = $Config->Get('GnuPGOptions');
124     unless ( File::Spec->file_name_is_absolute( $gpgopts->{homedir} ) ) {
125         $gpgopts->{homedir} = File::Spec->catfile( $BasePath, $gpgopts->{homedir} );
126     }
127
128     return $Config;
129 }
130
131 =head2 Init
132
133 L<Connects to the database|/ConnectToDatabase>, L<initilizes system
134 objects|/InitSystemObjects>, L<preloads classes|/InitClasses>, L<sets
135 up logging|/InitLogging>, and L<loads plugins|/InitPlugins>.
136
137 =cut
138
139 sub Init {
140
141     my @arg = @_;
142
143     CheckPerlRequirements();
144
145     InitPluginPaths();
146
147     #Get a database connection
148     ConnectToDatabase();
149     InitSystemObjects();
150     InitClasses();
151     InitLogging(@arg);
152     InitPlugins();
153     RT::I18N->Init;
154     RT->Config->PostLoadCheck;
155
156 }
157
158 =head2 ConnectToDatabase
159
160 Get a database connection. See also L</Handle>.
161
162 =cut
163
164 sub ConnectToDatabase {
165     require RT::Handle;
166     $Handle = RT::Handle->new unless $Handle;
167     $Handle->Connect;
168     return $Handle;
169 }
170
171 =head2 InitLogging
172
173 Create the Logger object and set up signal handlers.
174
175 =cut
176
177 sub InitLogging {
178
179     my %arg = @_;
180
181     # We have to set the record separator ($, man perlvar)
182     # or Log::Dispatch starts getting
183     # really pissy, as some other module we use unsets it.
184     $, = '';
185     use Log::Dispatch 1.6;
186
187     my %level_to_num = (
188         map( { $_ => } 0..7 ),
189         debug     => 0,
190         info      => 1,
191         notice    => 2,
192         warning   => 3,
193         error     => 4, 'err' => 4,
194         critical  => 5, crit  => 5,
195         alert     => 6,
196         emergency => 7, emerg => 7,
197     );
198
199     unless ( $RT::Logger ) {
200
201         $RT::Logger = Log::Dispatch->new;
202
203         my $stack_from_level;
204         if ( $stack_from_level = RT->Config->Get('LogStackTraces') ) {
205             # if option has old style '\d'(true) value
206             $stack_from_level = 0 if $stack_from_level =~ /^\d+$/;
207             $stack_from_level = $level_to_num{ $stack_from_level } || 0;
208         } else {
209             $stack_from_level = 99; # don't log
210         }
211
212         my $simple_cb = sub {
213             # if this code throw any warning we can get segfault
214             no warnings;
215             my %p = @_;
216
217             # skip Log::* stack frames
218             my $frame = 0;
219             $frame++ while caller($frame) && caller($frame) =~ /^Log::/;
220             my ($package, $filename, $line) = caller($frame);
221
222             $p{'message'} =~ s/(?:\r*\n)+$//;
223             return "[". gmtime(time) ."] [". $p{'level'} ."]: "
224                 . $p{'message'} ." ($filename:$line)\n";
225         };
226
227         my $syslog_cb = sub {
228             # if this code throw any warning we can get segfault
229             no warnings;
230             my %p = @_;
231
232             my $frame = 0; # stack frame index
233             # skip Log::* stack frames
234             $frame++ while caller($frame) && caller($frame) =~ /^Log::/;
235             my ($package, $filename, $line) = caller($frame);
236
237             # syswrite() cannot take utf8; turn it off here.
238             Encode::_utf8_off($p{message});
239
240             $p{message} =~ s/(?:\r*\n)+$//;
241             if ($p{level} eq 'debug') {
242                 return "$p{message}\n";
243             } else {
244                 return "$p{message} ($filename:$line)\n";
245             }
246         };
247
248         my $stack_cb = sub {
249             no warnings;
250             my %p = @_;
251             return $p{'message'} unless $level_to_num{ $p{'level'} } >= $stack_from_level;
252
253             require Devel::StackTrace;
254             my $trace = Devel::StackTrace->new( ignore_class => [ 'Log::Dispatch', 'Log::Dispatch::Base' ] );
255             return $p{'message'} . $trace->as_string;
256
257             # skip calling of the Log::* subroutins
258             my $frame = 0;
259             $frame++ while caller($frame) && caller($frame) =~ /^Log::/;
260             $frame++ while caller($frame) && (caller($frame))[3] =~ /^Log::/;
261
262             $p{'message'} .= "\nStack trace:\n";
263             while( my ($package, $filename, $line, $sub) = caller($frame++) ) {
264                 $p{'message'} .= "\t$sub(...) called at $filename:$line\n";
265             }
266             return $p{'message'};
267         };
268
269         if ( $Config->Get('LogToFile') ) {
270             my ($filename, $logdir) = (
271                 $Config->Get('LogToFileNamed') || 'rt.log',
272                 $Config->Get('LogDir') || File::Spec->catdir( $VarPath, 'log' ),
273             );
274             if ( $filename =~ m![/\\]! ) { # looks like an absolute path.
275                 ($logdir) = $filename =~ m{^(.*[/\\])};
276             }
277             else {
278                 $filename = File::Spec->catfile( $logdir, $filename );
279             }
280
281             unless ( -d $logdir && ( ( -f $filename && -w $filename ) || -w $logdir ) ) {
282                 # localizing here would be hard when we don't have a current user yet
283                 die "Log file '$filename' couldn't be written or created.\n RT can't run.";
284             }
285
286             require Log::Dispatch::File;
287             $RT::Logger->add( Log::Dispatch::File->new
288                            ( name=>'file',
289                              min_level=> $Config->Get('LogToFile'),
290                              filename=> $filename,
291                              mode=>'append',
292                              callbacks => [ $simple_cb, $stack_cb ],
293                            ));
294         }
295         if ( $Config->Get('LogToScreen') ) {
296             require Log::Dispatch::Screen;
297             $RT::Logger->add( Log::Dispatch::Screen->new
298                          ( name => 'screen',
299                            min_level => $Config->Get('LogToScreen'),
300                            callbacks => [ $simple_cb, $stack_cb ],
301                            stderr => 1,
302                          ));
303         }
304         if ( $Config->Get('LogToSyslog') ) {
305             require Log::Dispatch::Syslog;
306             $RT::Logger->add(Log::Dispatch::Syslog->new
307                          ( name => 'syslog',
308                            ident => 'RT',
309                            min_level => $Config->Get('LogToSyslog'),
310                            callbacks => [ $syslog_cb, $stack_cb ],
311                            stderr => 1,
312                            $Config->Get('LogToSyslogConf'),
313                          ));
314         }
315     }
316     InitSignalHandlers(%arg);
317 }
318
319 sub InitSignalHandlers {
320
321     my %arg = @_;
322     return if $arg{'NoSignalHandlers'};
323
324 # Signal handlers
325 ## This is the default handling of warnings and die'ings in the code
326 ## (including other used modules - maybe except for errors catched by
327 ## Mason).  It will log all problems through the standard logging
328 ## mechanism (see above).
329
330     $SIG{__WARN__} = sub {
331         # The 'wide character' warnings has to be silenced for now, at least
332         # until HTML::Mason offers a sane way to process both raw output and
333         # unicode strings.
334         # use 'goto &foo' syntax to hide ANON sub from stack
335         if( index($_[0], 'Wide character in ') != 0 ) {
336             unshift @_, $RT::Logger, qw(level warning message);
337             goto &Log::Dispatch::log;
338         }
339     };
340
341 #When we call die, trap it and log->crit with the value of the die.
342
343     $SIG{__DIE__}  = sub {
344         # if we are not in eval and perl is not parsing code
345         # then rollback transactions and log RT error
346         unless ($^S || !defined $^S ) {
347             $RT::Handle->Rollback(1) if $RT::Handle;
348             $RT::Logger->crit("$_[0]") if $RT::Logger;
349         }
350         die $_[0];
351     };
352 }
353
354
355 sub CheckPerlRequirements {
356     if ($^V < 5.008003) {
357         die sprintf "RT requires Perl v5.8.3 or newer.  Your current Perl is v%vd\n", $^V;
358     }
359
360     # use $error here so the following "die" can still affect the global $@
361     my $error;
362     {
363         local $@;
364         eval {
365             my $x = '';
366             my $y = \$x;
367             require Scalar::Util;
368             Scalar::Util::weaken($y);
369         };
370         $error = $@;
371     }
372
373     if ($error) {
374         die <<"EOF";
375
376 RT requires the Scalar::Util module be built with support for  the 'weaken'
377 function.
378
379 It is sometimes the case that operating system upgrades will replace
380 a working Scalar::Util with a non-working one. If your system was working
381 correctly up until now, this is likely the cause of the problem.
382
383 Please reinstall Scalar::Util, being careful to let it build with your C
384 compiler. Usually this is as simple as running the following command as
385 root.
386
387     perl -MCPAN -e'install Scalar::Util'
388
389 EOF
390
391     }
392 }
393
394 =head2 InitClasses
395
396 Load all modules that define base classes.
397
398 =cut
399
400 sub InitClasses {
401     shift if @_%2; # so we can call it as a function or method
402     my %args = (@_);
403     require RT::Tickets;
404     require RT::Transactions;
405     require RT::Attachments;
406     require RT::Users;
407     require RT::Principals;
408     require RT::CurrentUser;
409     require RT::Templates;
410     require RT::Queues;
411     require RT::ScripActions;
412     require RT::ScripConditions;
413     require RT::Scrips;
414     require RT::Groups;
415     require RT::GroupMembers;
416     require RT::CustomFields;
417     require RT::CustomFieldValues;
418     require RT::ObjectCustomFields;
419     require RT::ObjectCustomFieldValues;
420     require RT::Attributes;
421     require RT::Dashboard;
422     require RT::Approval;
423     require RT::Lifecycle;
424     require RT::Link;
425     require RT::Links;
426     require RT::Article;
427     require RT::Articles;
428     require RT::Class;
429     require RT::Classes;
430     require RT::ObjectClass;
431     require RT::ObjectClasses;
432     require RT::ObjectTopic;
433     require RT::ObjectTopics;
434     require RT::Topic;
435     require RT::Topics;
436
437     # on a cold server (just after restart) people could have an object
438     # in the session, as we deserialize it so we never call constructor
439     # of the class, so the list of accessible fields is empty and we die
440     # with "Method xxx is not implemented in RT::SomeClass"
441
442     # without this, we also can never call _ClassAccessible, because we
443     # won't have filled RT::Record::_TABLE_ATTR
444     $_->_BuildTableAttributes foreach qw(
445         RT::Ticket
446         RT::Transaction
447         RT::Attachment
448         RT::User
449         RT::Principal
450         RT::Template
451         RT::Queue
452         RT::ScripAction
453         RT::ScripCondition
454         RT::Scrip
455         RT::Group
456         RT::GroupMember
457         RT::CustomField
458         RT::CustomFieldValue
459         RT::ObjectCustomField
460         RT::ObjectCustomFieldValue
461         RT::Attribute
462         RT::ACE
463         RT::Link
464         RT::Article
465         RT::Class
466         RT::ObjectClass
467         RT::ObjectTopic
468         RT::Topic
469     );
470
471     if ( $args{'Heavy'} ) {
472         # load scrips' modules
473         my $scrips = RT::Scrips->new(RT->SystemUser);
474         $scrips->Limit( FIELD => 'Stage', OPERATOR => '!=', VALUE => 'Disabled' );
475         while ( my $scrip = $scrips->Next ) {
476             local $@;
477             eval { $scrip->LoadModules } or
478                 $RT::Logger->error("Invalid Scrip ".$scrip->Id.".  Unable to load the Action or Condition.  ".
479                                    "You should delete or repair this Scrip in the admin UI.\n$@\n");
480         }
481
482         foreach my $class ( grep $_, RT->Config->Get('CustomFieldValuesSources') ) {
483             local $@;
484             eval "require $class; 1" or $RT::Logger->error(
485                 "Class '$class' is listed in CustomFieldValuesSources option"
486                 ." in the config, but we failed to load it:\n$@\n"
487             );
488         }
489
490     }
491 }
492
493 =head2 InitSystemObjects
494
495 Initializes system objects: C<$RT::System>, C<< RT->SystemUser >>
496 and C<< RT->Nobody >>.
497
498 =cut
499
500 sub InitSystemObjects {
501
502     #RT's system user is a genuine database user. its id lives here
503     require RT::CurrentUser;
504     $SystemUser = RT::CurrentUser->new;
505     $SystemUser->LoadByName('RT_System');
506
507     #RT's "nobody user" is a genuine database user. its ID lives here.
508     $Nobody = RT::CurrentUser->new;
509     $Nobody->LoadByName('Nobody');
510
511     require RT::System;
512     $System = RT::System->new( $SystemUser );
513 }
514
515 =head1 CLASS METHODS
516
517 =head2 Config
518
519 Returns the current L<config object|RT::Config>, but note that
520 you must L<load config|/LoadConfig> first otherwise this method
521 returns undef.
522
523 Method can be called as class method.
524
525 =cut
526
527 sub Config { return $Config || shift->LoadConfig(); }
528
529 =head2 DatabaseHandle
530
531 Returns the current L<database handle object|RT::Handle>.
532
533 See also L</ConnectToDatabase>.
534
535 =cut
536
537 sub DatabaseHandle { return $Handle }
538
539 =head2 Logger
540
541 Returns the logger. See also L</InitLogging>.
542
543 =cut
544
545 sub Logger { return $Logger }
546
547 =head2 System
548
549 Returns the current L<system object|RT::System>. See also
550 L</InitSystemObjects>.
551
552 =cut
553
554 sub System { return $System }
555
556 =head2 SystemUser
557
558 Returns the system user's object, it's object of
559 L<RT::CurrentUser> class that represents the system. See also
560 L</InitSystemObjects>.
561
562 =cut
563
564 sub SystemUser { return $SystemUser }
565
566 =head2 Nobody
567
568 Returns object of Nobody. It's object of L<RT::CurrentUser> class
569 that represents a user who can own ticket and nothing else. See
570 also L</InitSystemObjects>.
571
572 =cut
573
574 sub Nobody { return $Nobody }
575
576 sub PrivilegedUsers {
577     if (!$_Privileged) {
578     $_Privileged = RT::Group->new(RT->SystemUser);
579     $_Privileged->LoadSystemInternalGroup('Privileged');
580     }
581     return $_Privileged;
582 }
583
584 sub UnprivilegedUsers {
585     if (!$_Unprivileged) {
586     $_Unprivileged = RT::Group->new(RT->SystemUser);
587     $_Unprivileged->LoadSystemInternalGroup('Unprivileged');
588     }
589     return $_Unprivileged;
590 }
591
592
593 =head2 Plugins
594
595 Returns a listref of all Plugins currently configured for this RT instance.
596 You can define plugins by adding them to the @Plugins list in your RT_SiteConfig
597
598 =cut
599
600 our @PLUGINS = ();
601 sub Plugins {
602     my $self = shift;
603     unless (@PLUGINS) {
604         $self->InitPluginPaths;
605         @PLUGINS = $self->InitPlugins;
606     }
607     return \@PLUGINS;
608 }
609
610 =head2 PluginDirs
611
612 Takes an optional subdir (e.g. po, lib, etc.) and returns a list of
613 directories from plugins where that subdirectory exists.
614
615 This code does not check plugin names, plugin validitity, or load
616 plugins (see L</InitPlugins>) in any way, and requires that RT's
617 configuration have been already loaded.
618
619 =cut
620
621 sub PluginDirs {
622     my $self = shift;
623     my $subdir = shift;
624
625     require RT::Plugin;
626
627     my @res;
628     foreach my $plugin (grep $_, RT->Config->Get('Plugins')) {
629         my $path = RT::Plugin->new( name => $plugin )->Path( $subdir );
630         next unless -d $path;
631         push @res, $path;
632     }
633     return @res;
634 }
635
636 =head2 InitPluginPaths
637
638 Push plugins' lib paths into @INC right after F<local/lib>.
639 In case F<local/lib> isn't in @INC, append them to @INC
640
641 =cut
642
643 sub InitPluginPaths {
644     my $self = shift || __PACKAGE__;
645
646     my @lib_dirs = $self->PluginDirs('lib');
647
648     my @tmp_inc;
649     my $added;
650     for (@INC) {
651         if ( Cwd::realpath($_) eq $RT::LocalLibPath) {
652             push @tmp_inc, $_, @lib_dirs;
653             $added = 1;
654         } else {
655             push @tmp_inc, $_;
656         }
657     }
658
659     # append @lib_dirs in case $RT::LocalLibPath isn't in @INC
660     push @tmp_inc, @lib_dirs unless $added;
661
662     my %seen;
663     @INC = grep !$seen{$_}++, @tmp_inc;
664 }
665
666 =head2 InitPlugins
667
668 Initialize all Plugins found in the RT configuration file, setting up
669 their lib and L<HTML::Mason> component roots.
670
671 =cut
672
673 sub InitPlugins {
674     my $self    = shift;
675     my @plugins;
676     require RT::Plugin;
677     foreach my $plugin (grep $_, RT->Config->Get('Plugins')) {
678         $plugin->require;
679         die $UNIVERSAL::require::ERROR if ($UNIVERSAL::require::ERROR);
680         push @plugins, RT::Plugin->new(name =>$plugin);
681     }
682     return @plugins;
683 }
684
685
686 sub InstallMode {
687     my $self = shift;
688     if (@_) {
689         my ($integrity, $state, $msg) = RT::Handle->CheckIntegrity;
690         if ($_[0] and $integrity) {
691             # Trying to turn install mode on but we have a good DB!
692             require Carp;
693             $RT::Logger->error(
694                 Carp::longmess("Something tried to turn on InstallMode but we have DB integrity!")
695             );
696         }
697         else {
698             $_INSTALL_MODE = shift;
699             if($_INSTALL_MODE) {
700                 require RT::CurrentUser;
701                $SystemUser = RT::CurrentUser->new();
702             }
703         }
704     }
705     return $_INSTALL_MODE;
706 }
707
708 sub LoadGeneratedData {
709     my $class = shift;
710     my $pm_path = ( File::Spec->splitpath( $INC{'RT.pm'} ) )[1];
711
712     require "$pm_path/RT/Generated.pm" || die "Couldn't load RT::Generated: $@";
713     $class->CanonicalizeGeneratedPaths();
714 }
715
716 sub CanonicalizeGeneratedPaths {
717     my $class = shift;
718     unless ( File::Spec->file_name_is_absolute($EtcPath) ) {
719
720    # if BasePath exists and is absolute, we won't infer it from $INC{'RT.pm'}.
721    # otherwise RT.pm will make the source dir(where we configure RT) be the
722    # BasePath instead of the one specified by --prefix
723         unless ( -d $BasePath
724                  && File::Spec->file_name_is_absolute($BasePath) )
725         {
726             my $pm_path = ( File::Spec->splitpath( $INC{'RT.pm'} ) )[1];
727
728      # need rel2abs here is to make sure path is absolute, since $INC{'RT.pm'}
729      # is not always absolute
730             $BasePath = File::Spec->rel2abs(
731                           File::Spec->catdir( $pm_path, File::Spec->updir ) );
732         }
733
734         $BasePath = Cwd::realpath($BasePath);
735
736         for my $path (
737                     qw/EtcPath BinPath SbinPath VarPath LocalPath LocalEtcPath
738                     LocalLibPath LexiconPath LocalLexiconPath PluginPath
739                     LocalPluginPath MasonComponentRoot MasonLocalComponentRoot
740                     MasonDataDir MasonSessionDir/
741                      )
742         {
743             no strict 'refs';
744
745             # just change relative ones
746             $$path = File::Spec->catfile( $BasePath, $$path )
747                 unless File::Spec->file_name_is_absolute($$path);
748         }
749     }
750
751 }
752
753 =head2 AddJavaScript
754
755 helper method to add js files to C<JSFiles> config.
756 to add extra js files, you can add the following line
757 in the plugin's main file:
758
759     RT->AddJavaScript( 'foo.js', 'bar.js' ); 
760
761 =cut
762
763 sub AddJavaScript {
764     my $self = shift;
765
766     my @old = RT->Config->Get('JSFiles');
767     RT->Config->Set( 'JSFiles', @old, @_ );
768     return RT->Config->Get('JSFiles');
769 }
770
771 =head2 AddStyleSheets
772
773 helper method to add css files to C<CSSFiles> config
774
775 to add extra css files, you can add the following line
776 in the plugin's main file:
777
778     RT->AddStyleSheets( 'foo.css', 'bar.css' ); 
779
780 =cut
781
782 sub AddStyleSheets {
783     my $self = shift;
784     my @old = RT->Config->Get('CSSFiles');
785     RT->Config->Set( 'CSSFiles', @old, @_ );
786     return RT->Config->Get('CSSFiles');
787 }
788
789 =head2 JavaScript
790
791 helper method of RT->Config->Get('JSFiles')
792
793 =cut
794
795 sub JavaScript {
796     return RT->Config->Get('JSFiles');
797 }
798
799 =head2 StyleSheets
800
801 helper method of RT->Config->Get('CSSFiles')
802
803 =cut
804
805 sub StyleSheets {
806     return RT->Config->Get('CSSFiles');
807 }
808
809 =head1 BUGS
810
811 Please report them to rt-bugs@bestpractical.com, if you know what's
812 broken and have at least some idea of what needs to be fixed.
813
814 If you're not sure what's going on, report them rt-devel@lists.bestpractical.com.
815
816 =head1 SEE ALSO
817
818 L<RT::StyleGuide>
819 L<DBIx::SearchBuilder>
820
821 =cut
822
823 require RT::Base;
824 RT::Base->_ImportOverlays();
825
826 1;