Skip to content

Node.js based forum software built for the modern web

action:plugin.install and uninstall

barisusakli3e666adfea44
diff --git a/src/plugins/install.js b/src/plugins/install.js
index e9882cc449..55723f79b5 100644
--- a/src/plugins/install.js
+++ b/src/plugins/install.js
@@ -64,7 +64,7 @@ module.exports = function(Plugins) {
if (err) {
return callback(err);
}
-
+ var type = installed ? 'uninstall' : 'install';
async.waterfall([
function(next) {
Plugins.isActive(id, next);
@@ -82,10 +82,14 @@ module.exports = function(Plugins) {
npm.load({}, next);
},
function(res, next) {
- npm.commands[installed ? 'uninstall' : 'install'](installed ? id : [id + '@' + (version || 'latest')], next);
+ npm.commands[type](installed ? id : [id + '@' + (version || 'latest')], next);
}
], function(err) {
- callback(err, {id: id, installed: !installed});
+ if (err) {
+ return callback(err);
+ }
+ plugins.fireHook('action:plugin.' + type, id);
+ callback(null, {id: id, installed: !installed});
});
});
}