[wellwell-devel] [wellwell/zoom] Set TemplateDir for plugins enabled in the plugins table.

Stefan Hornburg wellwell-devel at rt.icdevgroup.org
Sun Oct 24 19:50:28 UTC 2010


commit beff8decb77d326e9ca358b5aaef46098d5cedef
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Sun Oct 24 16:04:11 2010 +0200

    Set TemplateDir for plugins enabled in the plugins table.
    Fix typo in error message from plugin_scan_sub.
    Rename function plugins to plugins_from_var.

 lib/WellWell/Core.pm |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/lib/WellWell/Core.pm b/lib/WellWell/Core.pm
index 3390563..920cc2e 100644
--- a/lib/WellWell/Core.pm
+++ b/lib/WellWell/Core.pm
@@ -41,7 +41,7 @@ Vend::Config::parse_subroutine('GlobalSub', 'plugin_scan WellWell::Core::plugin_
 # space, and nothing else
 Vend::Config::parse_tag('UserTag', 'values_update MapRoutine Vend::Dispatch::update_values');
 
-sub plugins {
+sub plugins_from_var {
 	my @plugins;
 	
 	# simply return a list of plugins sitting in $Variable
@@ -52,16 +52,17 @@ sub plugins {
 
 # called at startup to scan plugins
 sub plugin_scan_sub {
-	my ($dbif, $plref);
+	my ($dbif, $plref, $active);
 
 	$dbif = WellWell::Data::easy_handle();
-	$plref = WellWell::Plugin::plugin_scan($dbif, "$Vend::Cfg->{VendRoot}/plugins",
-										   "$Vend::Cfg->{VendRoot}/local/plugins");
+	
+	$plref = WellWell::Plugin::plugin_scan($dbif, 'plugins', 'local/plugins');
 
-	for my $plugin (plugins()) {
+	# first pass for enabling plugins in the database from PLUGINS variable
+	for my $plugin (plugins_from_var()) {
 		if (exists $plref->{$plugin}) {
 			if ($plref->{$plugin}->{active} eq 0) {
-				Vend::Config::config_error("Plugin $plugin used in PLUGIN variable is explicitly disabled in plugins table.");
+				Vend::Config::config_error("Plugin $plugin used in PLUGINS variable is explicitly disabled in plugins table.");
 				return;
 			}
 			elsif (! defined($plref->{$plugin}->{active})) {
@@ -70,6 +71,14 @@ sub plugin_scan_sub {
 			}
 		}
 	}
+
+	for my $plugin (keys %$plref) {
+		if ($plref->{$plugin}->{active}) {
+			# search path for components and pages
+			push(@{$Vend::Cfg->{TemplateDir}}, $plref->{$plugin}->{directory},
+				 "$plref->{$plugin}->{directory}/pages");
+		}
+	}
 }
 
 sub hooks {



More information about the wellwell-devel mailing list