[geeklog-cvs] geeklog: Changed PLG_configChange to also notify plugins of conf...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Apr 11 13:45:18 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/5dd79ca26230
changeset: 6921:5dd79ca26230
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Apr 11 17:55:09 2009 +0200
description:
Changed PLG_configChange to also notify plugins of config changes in other plugins but without providing details (plugins should not depend on internals of other plugins).

diffstat:

1 file changed, 17 insertions(+), 13 deletions(-)
system/lib-plugins.php |   30 +++++++++++++++++-------------

diffs (51 lines):

diff -r add909bdec43 -r 5dd79ca26230 system/lib-plugins.php
--- a/system/lib-plugins.php	Sat Apr 11 17:03:12 2009 +0200
+++ b/system/lib-plugins.php	Sat Apr 11 17:55:09 2009 +0200
@@ -2519,8 +2519,9 @@
 /**
 * Inform plugins of configuration changes
 *
-* NOTE: Plugins will only be notified of 'Core' changes and changes in their
-*       own configuration. Changes in other plugins will not be sent.
+* NOTE: Plugins will only be notified of details of changes in 'Core' and in
+*       their own configuration. For other plugins, they will only be notified
+*       of the fact that something in the other plugin's config changed.
 *
 * @param    string  $group      plugin name or 'Core' for $_CONF changes
 * @param    array   $changes    names of config values that changed
@@ -2533,21 +2534,24 @@
 {
     global $_PLUGINS;
 
-    $args[1] = $group;
-    $args[2] = $changes;
+    foreach ($_PLUGINS as $pi_name) {
+        $args = array();
+        $args[1] = $group;
 
-    if ($group == 'Core') {
-        foreach ($_PLUGINS as $pi_name) {
-            PLG_callFunctionForOnePlugin('plugin_configchange_' . $pi_name,
-                                         $args);
+        if (($group == 'Core') || ($group == $pi_name)) {
+            $args[2] = $changes;
         }
 
-        $function = 'CUSTOM_configchange';
-        if (function_exists($function)) {
-            $function('Core', $changes);
+        PLG_callFunctionForOnePlugin('plugin_configchange_' . $pi_name, $args);
+    }
+
+    $function = 'CUSTOM_configchange';
+    if (function_exists($function)) {
+        if ($group == 'Core') {
+            $function($group, $changes);
+        } else {
+            $function($group);
         }
-    } else {
-        PLG_callFunctionForOnePlugin('plugin_configchange_' . $group, $args);
     }
 }
 



More information about the geeklog-cvs mailing list