plug-ins are now dynamically loaded
This commit is contained in:
parent
f83b2c6086
commit
8266dfd69a
11 changed files with 47 additions and 36 deletions
|
|
@ -3,6 +3,10 @@
|
||||||
- Added a --history option to upgrade.pl that displays the upgrade history
|
- Added a --history option to upgrade.pl that displays the upgrade history
|
||||||
for each site.
|
for each site.
|
||||||
- Fixed a typo in User.pm
|
- Fixed a typo in User.pm
|
||||||
|
- All plugins are now dynamically loaded. This provides a performance gain of
|
||||||
|
over 100% in CGI mode, 10% in mod_perl mode, and less memory usage in
|
||||||
|
mod_perl mode.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
6.0.3
|
6.0.3
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,11 @@ versions. Be sure to heed the warnings contained herein as they will
|
||||||
save you many hours of grief.
|
save you many hours of grief.
|
||||||
|
|
||||||
|
|
||||||
|
6.1.0
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
* See docs/migration.txt for changes in plug-in coding.
|
||||||
|
|
||||||
|
|
||||||
6.0.2
|
6.0.2
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
* You need to add all of your site aliases to the sitename variable
|
* You need to add all of your site aliases to the sitename variable
|
||||||
|
|
|
||||||
|
|
@ -103,5 +103,13 @@ way, including the constructor. We removed depricated parameters from the method
|
||||||
which will cause pagination not to function in items that have not been updated.
|
which will cause pagination not to function in items that have not been updated.
|
||||||
|
|
||||||
|
|
||||||
|
5.4 Dynamic Plug-in Loading
|
||||||
|
|
||||||
|
In 6.1 plug-ins (Wobjects, Macros, and Auth) are all dynamically loaded. They
|
||||||
|
used to be statically loaded at session open time. If you are writing
|
||||||
|
something that uses a macro, wobject, or auth module outside of the usual
|
||||||
|
mechanisms that call those plug-ins, then you'll need to write a piece of code
|
||||||
|
to load the plug-in at use time.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,9 @@ sub _processFunctions {
|
||||||
} else {
|
} else {
|
||||||
if (WebGUI::Privilege::canViewPage()) {
|
if (WebGUI::Privilege::canViewPage()) {
|
||||||
$cmd = "WebGUI::Wobject::".${$wobject}{namespace};
|
$cmd = "WebGUI::Wobject::".${$wobject}{namespace};
|
||||||
|
my $load = "use ".$cmd; # gotta load the wobject before you can use it
|
||||||
|
eval($load);
|
||||||
|
WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
|
||||||
$w = eval{$cmd->new($wobject)};
|
$w = eval{$cmd->new($wobject)};
|
||||||
WebGUI::ErrorHandler::fatalError("Couldn't instanciate wobject: ${$wobject}{namespace}. Root Cause: ".$@) if($@);
|
WebGUI::ErrorHandler::fatalError("Couldn't instanciate wobject: ${$wobject}{namespace}. Root Cause: ".$@) if($@);
|
||||||
if ($session{form}{func} =~ /^[A-Za-z]+$/) {
|
if ($session{form}{func} =~ /^[A-Za-z]+$/) {
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,11 @@ sub process {
|
||||||
$params = &process($params); # recursive process params
|
$params = &process($params); # recursive process params
|
||||||
}
|
}
|
||||||
if ($session{config}{macros}{$searchString} ne "") {
|
if ($session{config}{macros}{$searchString} ne "") {
|
||||||
my $cmd = "WebGUI::Macro::".$session{config}{macros}{$searchString}."::process";
|
my $cmd = "WebGUI::Macro::".$session{config}{macros}{$searchString};
|
||||||
|
my $load = "use ".$cmd;
|
||||||
|
eval($load);
|
||||||
|
WebGUI::ErrorHandler::warn("Macro failed to compile: $cmd.".$@) if($@);
|
||||||
|
$cmd = $cmd."::process";
|
||||||
my $result = eval{&$cmd($params)};
|
my $result = eval{&$cmd($params)};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
WebGUI::ErrorHandler::warn("Processing failed on macro: $macro: ".$@);
|
WebGUI::ErrorHandler::warn("Processing failed on macro: $macro: ".$@);
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@ sub process {
|
||||||
$var{'contentTypes.label'} = WebGUI::International::get(1083);
|
$var{'contentTypes.label'} = WebGUI::International::get(1083);
|
||||||
foreach my $namespace (@{$session{config}{wobjects}}) {
|
foreach my $namespace (@{$session{config}{wobjects}}) {
|
||||||
my $cmd = "WebGUI::Wobject::".$namespace;
|
my $cmd = "WebGUI::Wobject::".$namespace;
|
||||||
|
my $load = "use ".$cmd;
|
||||||
|
eval($load);
|
||||||
|
WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
|
||||||
my $w = eval{$cmd->new({namespace=>$namespace,wobjectId=>"new"})};
|
my $w = eval{$cmd->new({namespace=>$namespace,wobjectId=>"new"})};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
WebGUI::ErrorHandler::warn("Could not use wobject $namespace because: ".$@);
|
WebGUI::ErrorHandler::warn("Could not use wobject $namespace because: ".$@);
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ sub getInstance {
|
||||||
my $userId = $_[1];
|
my $userId = $_[1];
|
||||||
#Create Auth Object
|
#Create Auth Object
|
||||||
my $cmd = "WebGUI::Auth::".$authMethod;
|
my $cmd = "WebGUI::Auth::".$authMethod;
|
||||||
|
my $load = "use ".$cmd;
|
||||||
|
WebGUI::ErrorHandler::fatalError("Authentication module failed to compile: $cmd.".$@) if($@);
|
||||||
|
eval($load);
|
||||||
my $auth = eval{$cmd->new($authMethod,$userId)};
|
my $auth = eval{$cmd->new($authMethod,$userId)};
|
||||||
WebGUI::ErrorHandler::fatalError("Couldn't instanciate authentication module: $authMethod. Root cause: ".$@) if($@);
|
WebGUI::ErrorHandler::fatalError("Couldn't instanciate authentication module: $authMethod. Root cause: ".$@) if($@);
|
||||||
return $auth;
|
return $auth;
|
||||||
|
|
@ -100,4 +103,4 @@ sub www_recoverPassword {
|
||||||
return www_auth("recoverPassword");
|
return www_auth("recoverPassword");
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@ sub _duplicateWobjects {
|
||||||
my $sth = WebGUI::SQL->read("select * from wobject where pageId=$_[0] order by sequenceNumber");
|
my $sth = WebGUI::SQL->read("select * from wobject where pageId=$_[0] order by sequenceNumber");
|
||||||
while (my $wobject = $sth->hashRef) {
|
while (my $wobject = $sth->hashRef) {
|
||||||
my $cmd = "WebGUI::Wobject::".${$wobject}{namespace};
|
my $cmd = "WebGUI::Wobject::".${$wobject}{namespace};
|
||||||
|
my $load = "use ".$cmd;
|
||||||
|
eval($load);
|
||||||
|
WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
|
||||||
my $w = $cmd->new($wobject);
|
my $w = $cmd->new($wobject);
|
||||||
$w->duplicate($_[1]);
|
$w->duplicate($_[1]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ sub _purgeUserTrash {
|
||||||
where wobjectId=".$base->{wobjectId});
|
where wobjectId=".$base->{wobjectId});
|
||||||
%properties = (%{$base}, %{$extended});
|
%properties = (%{$base}, %{$extended});
|
||||||
$cmd = "WebGUI::Wobject::".$properties{namespace};
|
$cmd = "WebGUI::Wobject::".$properties{namespace};
|
||||||
|
my $load = "use ".$cmd;
|
||||||
|
eval($load);
|
||||||
|
WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
|
||||||
$w = $cmd->new(\%properties);
|
$w = $cmd->new(\%properties);
|
||||||
$w->purge;
|
$w->purge;
|
||||||
}
|
}
|
||||||
|
|
@ -70,6 +73,9 @@ sub _purgeWobject {
|
||||||
where wobjectId=".$base->{wobjectId});
|
where wobjectId=".$base->{wobjectId});
|
||||||
%properties = (%{$base}, %{$extended});
|
%properties = (%{$base}, %{$extended});
|
||||||
$cmd = "WebGUI::Wobject::".$properties{namespace};
|
$cmd = "WebGUI::Wobject::".$properties{namespace};
|
||||||
|
my $load = "use ".$cmd;
|
||||||
|
eval($load);
|
||||||
|
WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
|
||||||
$w = $cmd->new(\%properties);
|
$w = $cmd->new(\%properties);
|
||||||
$w->purge;
|
$w->purge;
|
||||||
}
|
}
|
||||||
|
|
@ -86,6 +92,9 @@ sub _purgeWobjects {
|
||||||
where wobjectId=".$base->{wobjectId});
|
where wobjectId=".$base->{wobjectId});
|
||||||
%properties = (%{$base}, %{$extended});
|
%properties = (%{$base}, %{$extended});
|
||||||
$cmd = "WebGUI::Wobject::".$properties{namespace};
|
$cmd = "WebGUI::Wobject::".$properties{namespace};
|
||||||
|
my $load = "use ".$cmd;
|
||||||
|
eval($load);
|
||||||
|
WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
|
||||||
$w = $cmd->new(\%properties);
|
$w = $cmd->new(\%properties);
|
||||||
$w->purge;
|
$w->purge;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -363,6 +363,9 @@ sub generate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $cmd = "WebGUI::Wobject::".${$wobject}{namespace};
|
my $cmd = "WebGUI::Wobject::".${$wobject}{namespace};
|
||||||
|
my $load = 'use '.$cmd;
|
||||||
|
eval($load);
|
||||||
|
WebGUI::ErrorHandler::warn("Wobject failed to compile: $cmd.".$@) if($@);
|
||||||
my $w = eval{$cmd->new($wobject)};
|
my $w = eval{$cmd->new($wobject)};
|
||||||
WebGUI::ErrorHandler::fatalError("Couldn't instanciate wobject: ${$wobject}{namespace}. Root cause: ".$@) if($@);
|
WebGUI::ErrorHandler::fatalError("Couldn't instanciate wobject: ${$wobject}{namespace}. Root cause: ".$@) if($@);
|
||||||
push(@{$var{'position'.$wobject->{templatePosition}.'_loop'}},{
|
push(@{$var{'position'.$wobject->{templatePosition}.'_loop'}},{
|
||||||
|
|
|
||||||
|
|
@ -169,37 +169,6 @@ sub _time {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
sub _loadAuthentication {
|
|
||||||
foreach my $namespace (@{$session{config}{authMethods}}) {
|
|
||||||
my $cmd = "use WebGUI::Auth::".$namespace;
|
|
||||||
eval($cmd);
|
|
||||||
if ($@) {
|
|
||||||
WebGUI::ErrorHandler::warn("Authentication module failed to compile: $namespace. ".$@);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
sub _loadMacros {
|
|
||||||
foreach my $key (keys %{$session{config}{macros}}) {
|
|
||||||
my $cmd = "use WebGUI::Macro::".$session{config}{macros}{$key};
|
|
||||||
eval($cmd);
|
|
||||||
WebGUI::ErrorHandler::fatalError("Macro failed to compile: $key.".$@) if($@);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
sub _loadWobjects {
|
|
||||||
foreach my $namespace (@{$session{config}{wobjects}}) {
|
|
||||||
my $cmd = "use WebGUI::Wobject::".$namespace;
|
|
||||||
eval($cmd);
|
|
||||||
if ($@) {
|
|
||||||
WebGUI::ErrorHandler::warn("Wobject failed to compile: $namespace. ".$@);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
# This routine returns an unique session Id.
|
# This routine returns an unique session Id.
|
||||||
sub _uniqueSessionId {
|
sub _uniqueSessionId {
|
||||||
|
|
@ -467,9 +436,6 @@ sub open {
|
||||||
$session{language} = WebGUI::SQL->quickHashRef("select * from language where languageId=$session{user}{language}");
|
$session{language} = WebGUI::SQL->quickHashRef("select * from language where languageId=$session{user}{language}");
|
||||||
###----------------------------
|
###----------------------------
|
||||||
### loading plugins
|
### loading plugins
|
||||||
_loadWobjects();
|
|
||||||
_loadMacros();
|
|
||||||
_loadAuthentication();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue