From e97042ac8d5ef1438185e233d33a4306a57392d0 Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Sun, 15 Feb 2015 17:43:38 +0000 Subject: [PATCH] Fixes c9/core+7. plugin manager should expose manually disabled plugins --- plugins/c9.core/ext.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/plugins/c9.core/ext.js b/plugins/c9.core/ext.js index 934c32ee..cf588ee9 100644 --- a/plugins/c9.core/ext.js +++ b/plugins/c9.core/ext.js @@ -76,7 +76,7 @@ define(function(require, exports, module) { emit("register", {plugin: plugin}); } - function unregisterPlugin(plugin, loaded, ignoreDeps) { + function unregisterPlugin(plugin, loaded, ignoreDeps, keep) { if (!plugin.registered) return; @@ -92,7 +92,8 @@ define(function(require, exports, module) { return false; } - // plugins.splice(plugins.indexOf(plugin), 1); + if (!keep) + plugins.splice(plugins.indexOf(plugin), 1); delete lut[plugin.name]; loaded(false, 0); @@ -184,7 +185,7 @@ define(function(require, exports, module) { throw new Error("Could not find plugin: " + name); var plugin = lut[name] - if (plugin.unload() === false) + if (plugin.unload({ keep: true }) === false) throw new Error("Failed unloading plugin: " + name); manuallyDisabled[name] = plugin; @@ -205,7 +206,14 @@ define(function(require, exports, module) { /** * */ - get named(){ return Object.create(lut); }, + get named(){ + var named = Object.create(lut); + for (var name in manuallyDisabled) { + if (!lut[name]) + lut[name] = manuallyDisabled[name]; + } + return named; + }, _events: [ /** @@ -502,7 +510,7 @@ define(function(require, exports, module) { if (event.emit("beforeUnload", e) === false) return false; - if (unregisterPlugin(this, init, ignoreDeps) === false) + if (unregisterPlugin(this, init, ignoreDeps, e && e.keep) === false) return false; loaded = false;