aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-28 23:40:14 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-28 23:40:14 +0000
commit3a0a8d773f23b45ae800e4637294d481c1befc43 (patch)
treec0cbd454e981b352db77f23d10a26acab770ce1f /engine/lib
parentd96be822af5685572992e8ca1c651e0b3e23541a (diff)
downloadelgg-3a0a8d773f23b45ae800e4637294d481c1befc43.tar.gz
elgg-3a0a8d773f23b45ae800e4637294d481c1befc43.tar.bz2
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
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/plugins.php26
1 files changed, 20 insertions, 6 deletions
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;
}
/**