aboutsummaryrefslogtreecommitdiff
path: root/lib/plugins/engine/PluginManager.class.php
diff options
context:
space:
mode:
authornoackorama <noackorama@gmail.com>2021-08-03 18:30:18 +0200
committernoackorama <noackorama@gmail.com>2021-08-03 18:30:18 +0200
commite4248dab785f59df2a09f84086a65b41bab6d7cb (patch)
tree01803615255481a39639a2106bc623f69c9cc2f0 /lib/plugins/engine/PluginManager.class.php
parent4ebcf92520bb486e5eeb686f01a842cb355e3354 (diff)
closes #37
Diffstat (limited to 'lib/plugins/engine/PluginManager.class.php')
-rw-r--r--lib/plugins/engine/PluginManager.class.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/plugins/engine/PluginManager.class.php b/lib/plugins/engine/PluginManager.class.php
index cd14841..1397359 100644
--- a/lib/plugins/engine/PluginManager.class.php
+++ b/lib/plugins/engine/PluginManager.class.php
@@ -244,9 +244,9 @@ class PluginManager
/**
* Sets the activation status of a plugin in the given context.
*
- * @param $id id of the plugin
- * @param $rangeId context range id
- * @param $active plugin status (true or false)
+ * @param $id string id of the plugin
+ * @param $rangeId string context range id
+ * @param $active bool plugin status (true or false)
*/
public function setPluginActivated ($id, $rangeId, $active)
{
@@ -270,6 +270,23 @@ class PluginManager
}
/**
+ * Sets the activation status of a plugin in the given context.
+ *
+ * @param $pluginid string of the plugin
+ * @param $user_id string user id
+ * @param $active bool plugin status (true or false)
+ */
+ public function setPluginActivatedForUser($pluginid, $user_id, $active)
+ {
+ $db = DBManager::get();
+ $state = $active ? 1 : 0;
+ unset($this->plugins_activated_cache[$user_id]);
+
+ return $db->execute("REPLACE INTO plugins_activated (pluginid, range_type, range_id, state)
+ VALUES (?, 'user', ?, ?)", [$pluginid, $user_id, $state]);
+ }
+
+ /**
* Deactivate all plugins for the given range.
*
* @param string $range_type Type of range (sem, inst or user)