diff options
author | ivan <ivan> | 2009-09-22 03:09:28 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-09-22 03:09:28 +0000 |
commit | aa0ce82aa8d9c19dc431ce66dc3f46982431c743 (patch) | |
tree | a39c734c9652db048142133097471ef4ef62e2fb | |
parent | f8d42a67010118a3b322e0a05f5c71f4dadf0aba (diff) |
add addl_comp_root.pl and addl_handler_use.pl config files, RT#4743
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | htetc/handler.pl | 27 |
2 files changed, 28 insertions, 0 deletions
@@ -164,6 +164,7 @@ install-docs: docs cp htetc/handler.pl ${MASON_HANDLER} perl -p -i -e "\ s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g; \ + s'%%%FREESIDE_CONF%%%'${FREESIDE_CONF}'g; \ s'%%%RT_ENABLED%%%'${RT_ENABLED}'g; \ s'%%%MASONDATA%%%'${MASONDATA}'g;\ " ${MASON_HANDLER} diff --git a/htetc/handler.pl b/htetc/handler.pl index 6721becc2..6cf78954a 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -4,6 +4,7 @@ package HTML::Mason; use strict; use vars qw($r); +use File::Slurp qw( slurp ); use HTML::Mason 1.27; #http://www.masonhq.com/?ApacheModPerl2Redirect use HTML::Mason::Interp; use HTML::Mason::Compiler::ToObject; @@ -32,6 +33,26 @@ if ( %%%RT_ENABLED%%% ) { die $@ if $@; } +# Some hooks supporting strange legacy ways people have added stuff on + +my @addl_comp_root = (); +my $addl_comp_root_file = '%%%FREESIDE_CONF%%%/addl_comp_root.pl'; +if ( -e $addl_comp_root_file ) { + my $text = slurp( $addl_comp_root_file ); + my @addl = eval $text; + if ( @addl && ! $@ ) { + @addl_comp_root = @addl; + } elsif ($@) { + warn "error parsing $addl_comp_root_file: $@\n"; + } +} + +$FS::Mason::addl_handler_use = ''; +my $addl_handler_use_file = '%%%FREESIDE_CONF%%%/addl_handler_use.pl'; +if ( -e $addl_handler_use_file ) { + $FS::Mason::addl_handler_use = slurp( $addl_handler_use_file ); +} + # Create Mason objects my %interp = ( @@ -43,6 +64,7 @@ my %interp = ( comp_root => [ [ 'freeside' => '%%%FREESIDE_DOCUMENT_ROOT%%%' ], [ 'rt' => '%%%FREESIDE_DOCUMENT_ROOT%%%/rt' ], + @addl_comp_root, ], ); @@ -217,6 +239,11 @@ sub handler use FS::reason; use FS::cust_main_note; + if ( $FS::Mason::addl_handler_use ) { + eval $FS::Mason::addl_handler_use; + die $@ if $@; + } + if ( %%%RT_ENABLED%%% ) { eval ' use RT::Tickets; |