mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
plugin installation takes a version now, and queries nbbpm, #2363
better error handling for #2363 upgrades now also call the suggestion route from nbbpm upgrade button will show alert now if you try to upgrade past the suggested version, #2363
This commit is contained in:
@@ -550,7 +550,7 @@ var fs = require('fs'),
|
||||
});
|
||||
};
|
||||
|
||||
Plugins.toggleInstall = function(id, callback) {
|
||||
Plugins.toggleInstall = function(id, version, callback) {
|
||||
Plugins.isInstalled(id, function(err, installed) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -573,7 +573,7 @@ var fs = require('fs'),
|
||||
npm.load({}, next);
|
||||
},
|
||||
function(res, next) {
|
||||
npm.commands[installed ? 'uninstall' : 'install'](installed ? id : [id], next);
|
||||
npm.commands[installed ? 'uninstall' : 'install'](installed ? id : [id + '@' + (version || 'latest')], next);
|
||||
}
|
||||
], function(err) {
|
||||
callback(err, {
|
||||
@@ -584,13 +584,13 @@ var fs = require('fs'),
|
||||
});
|
||||
};
|
||||
|
||||
Plugins.upgrade = function(id, callback) {
|
||||
Plugins.upgrade = function(id, version, callback) {
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
npm.load({}, next);
|
||||
},
|
||||
function(res, next) {
|
||||
npm.commands.install([id], next);
|
||||
npm.commands.install([id + '@' + (version || 'latest')], next);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user