From 3a0a8d773f23b45ae800e4637294d481c1befc43 Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 28 Jan 2010 23:40:14 +0000 Subject: Corrected clear_plugin_setting() to only remove a single plugin setting instead of all setting for a plugin. Added clear_all_plugin_settings() to remove all settings for a plugin. git-svn-id: http://code.elgg.org/elgg/trunk@3853 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/plugins.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 76692b447..d7c154b5f 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -53,10 +53,10 @@ class ElggPlugin extends ElggObject { $meta = get_private_setting($this->guid, $name); if ($meta === false) { - // Can't find it, so return null + // Can't find it, so return null return NULL; } - + return $meta; } @@ -230,10 +230,10 @@ function load_plugins() { if (!include($CONFIG->pluginspath . $mod . "/start.php")) { // automatically disable the bad plugin disable_plugin($mod); - + // register error rather than rendering the site unusable with exception register_error(sprintf(elgg_echo('PluginException:MisconfiguredPlugin'), $mod)); - + // continue loading remaining plugins continue; } @@ -554,11 +554,25 @@ function clear_plugin_setting($name, $plugin_name = "") { $plugin = find_plugin_settings($plugin_name); if ($plugin) { - //$plugin->clearMetaData($name); + return remove_private_setting($plugin->guid, $name); + } + + return FALSE; +} + +/** + * Clear all plugin settings. + * + * @param string $plugin_name Optional plugin name, if not specified then it is detected from where you are calling from. + */ +function clear_all_plugin_settings($plugin_name = "") { + $plugin = find_plugin_settings($plugin_name); + + if ($plugin) { return remove_all_private_settings($plugin->guid); } - return false; + return FALSE; } /** -- cgit v1.2.3