diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 884378146..07d879029 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,7 @@ 7.4.0 + - rfe: snippets should have titles too! + - Added a mechanism for using external folders for custom code. See + sbin/preload.custom.example for details. - Added a realtime workflow option for content publishing. - Added switches to auto request commit operations and skip adding comments. - fix: old recurring events were not deleted when changing recurrence pattern diff --git a/lib/WebGUI/Asset/Snippet.pm b/lib/WebGUI/Asset/Snippet.pm index 282f95788..572686086 100644 --- a/lib/WebGUI/Asset/Snippet.pm +++ b/lib/WebGUI/Asset/Snippet.pm @@ -164,7 +164,7 @@ sub view { WebGUI::Macro::process($self->session,\$output); $output = $self->getToolbar.$output if ($self->session->var->get("adminOn") && !$calledAsWebMethod); if ($self->getValue("processAsTemplate")) { - $output = WebGUI::Asset::Template->processRaw($self->session, $output); + $output = WebGUI::Asset::Template->processRaw($self->session, $output, $self->get); } if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10) { WebGUI::Cache->new($self->session,"view_".$calledAsWebMethod."_".$self->getId)->set($output,$self->get("cacheTimeout")); diff --git a/sbin/preload.custom.example b/sbin/preload.custom.example new file mode 100644 index 000000000..38e3fb571 --- /dev/null +++ b/sbin/preload.custom.example @@ -0,0 +1,4 @@ +# Add paths to lib folders where you have custom plugins for WebGUI. +# Note that the folder must contain the same directory structure of +# of WebGUI itself. This file should reside at WebGUI/sbin/preload.custom +/data/Custom/lib diff --git a/sbin/preload.exclude.example b/sbin/preload.exclude.example index c97f18d54..345993c2c 100644 --- a/sbin/preload.exclude.example +++ b/sbin/preload.exclude.example @@ -1,3 +1,7 @@ +# Create preload.exclude in your WebGUI/sbin directory and add modules to it +# that you don't want to be loaded by modperl. This will decrease the overall +# size of your modperl instances, which will increase performance, and reduce +# memory use. WebGUI::Cache::Database WebGUI::Auth::LDAP WebGUI::Asset::Wobject::WSClient diff --git a/sbin/preload.perl b/sbin/preload.perl index e4da6e26d..bddc64e7a 100644 --- a/sbin/preload.perl +++ b/sbin/preload.perl @@ -1,8 +1,20 @@ my $webguiRoot; +my $customLibs; BEGIN { $webguiRoot = "/data/WebGUI"; unshift (@INC, $webguiRoot."/lib"); + @{$customLibs} = (); + open(FILE,"<".$webguiRoot."/sbin/preload.custom"); + while (my $line = ) { + next if $line =~ m/^#/; + chomp $line; + push(@{$customLibs}, $line); + } + close(FILE); + foreach my $lib (@customLibs) { + unshift (@INC, $lib); + } } $|=1; @@ -10,7 +22,6 @@ $|=1; use strict; print "\nStarting WebGUI ".$WebGUI::VERSION."\n"; - #---------------------------------------- # Logger #---------------------------------------- @@ -39,12 +50,17 @@ my @modules = (); # these modules should always be skipped my @excludes = qw(WebGUI::i18n::English::Automated_Information WebGUI::PerformanceProfiler); open(FILE,"<".$webguiRoot."/sbin/preload.exclude"); -while () { - chomp; - push(@excludes,$_); +while (my $line = ) { + next if $line =~ m/^#/; + chomp $line; + push(@excludes, $line); } close(FILE); -File::Find::find(\&getWebGUIModules, $webguiRoot."/lib/WebGUI"); +my @folders = ($webguiRoot."/lib/WebGUI"); +foreach my $lib (@{$customLibs}) { + push(@folders, $lib."/WebGUI"); +} +File::Find::find(\&getWebGUIModules, @folders); foreach my $package (@modules) { next if (WebGUI::Utility::isIn($package,@excludes)); my $use = "use ".$package." ()"; @@ -79,7 +95,7 @@ sub getWebGUIModules { my $filename = $File::Find::dir."/".$_; return unless $filename =~ m/\.pm$/; my $package = $filename; - $package =~ s/^$webguiRoot\/lib\/(.*)\.pm$/$1/; + $package =~ s/.*\/lib\/(.*)\.pm$/$1/; $package =~ s/\//::/g; push(@modules,$package); }