From 5d9abb1e11262b5ef7c6f4695590ce5bdb257b85 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 27 Dec 2012 19:20:12 +0400 Subject: add plugin storage table to schema; add ability to clear plugin data --- classes/pluginhost.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'classes/pluginhost.php') diff --git a/classes/pluginhost.php b/classes/pluginhost.php index e43b39f9d..d7db7481c 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -1,9 +1,4 @@ load(join(",", $plugins), $kind); + $this->load(join(",", $plugins), $kind, $owner_uid); } function load($classlist, $kind, $owner_uid = false) { @@ -263,7 +258,7 @@ class PluginHost { if ($sync) $this->save_data(get_class($sender)); } - function get($sender, $name, $default_value) { + function get($sender, $name, $default_value = false) { $idx = get_class($sender); if (isset($this->storage[$idx][$name])) { @@ -278,5 +273,18 @@ class PluginHost { return $this->storage[$idx]; } + + function clear_data($sender) { + if ($this->owner_uid) { + $idx = get_class($sender); + + unset($this->storage[$idx]); + + db_query($this->link, "DELETE FROM ttrss_plugin_storage WHERE name = '$idx' + AND owner_uid = " . $this->owner_uid); + + $_SESSION["plugin_storage"] = $this->storage; + } + } } ?> -- cgit v1.2.3-54-g00ecf