diff --git a/db.js b/db.js index 467e04fc..9877f860 100644 --- a/db.js +++ b/db.js @@ -1501,10 +1501,10 @@ module.exports.CreateDB = function (parent, func) { if (obj.pluginsActive) { obj.addPlugin = function (plugin, func) { plugin.type = 'plugin'; obj.pluginsfile.insertOne(plugin, func); }; // Add a plugin obj.getPlugins = function (func) { obj.pluginsfile.find({ type: 'plugin' }).project({ type: 0 }).sort({ name: 1 }).toArray(func); }; // Get all plugins - obj.getPlugin = function (id, func) { id = require('mongodb').ObjectID(id); obj.pluginsfile.find({ _id: id }).sort({ name: 1 }).toArray(func); }; // Get plugin - obj.deletePlugin = function (id, func) { id = require('mongodb').ObjectID(id); obj.pluginsfile.deleteOne({ _id: id }, func); }; // Delete plugin - obj.setPluginStatus = function (id, status, func) { id = require('mongodb').ObjectID(id); obj.pluginsfile.updateOne({ _id: id }, { $set: { status: status } }, func); }; - obj.updatePlugin = function (id, args, func) { delete args._id; id = require('mongodb').ObjectID(id); obj.pluginsfile.updateOne({ _id: id }, { $set: args }, func); }; + obj.getPlugin = function (id, func) { id = require('mongodb').ObjectId(id); obj.pluginsfile.find({ _id: id }).sort({ name: 1 }).toArray(func); }; // Get plugin + obj.deletePlugin = function (id, func) { id = require('mongodb').ObjectId(id); obj.pluginsfile.deleteOne({ _id: id }, func); }; // Delete plugin + obj.setPluginStatus = function (id, status, func) { id = require('mongodb').ObjectId(id); obj.pluginsfile.updateOne({ _id: id }, { $set: { status: status } }, func); }; + obj.updatePlugin = function (id, args, func) { delete args._id; id = require('mongodb').ObjectId(id); obj.pluginsfile.updateOne({ _id: id }, { $set: args }, func); }; } } else { diff --git a/pluginHandler.js b/pluginHandler.js index 03f1e91d..953a8942 100644 --- a/pluginHandler.js +++ b/pluginHandler.js @@ -507,9 +507,8 @@ module.exports.pluginHandler = function (parent) { obj.removePlugin = function (id, func) { parent.db.getPlugin(id, function (err, docs) { var plugin = docs[0]; - var rimraf = require('rimraf'); let pluginPath = obj.parent.path.join(obj.pluginPath, plugin.shortName); - rimraf.sync(pluginPath); + obj.fs.rmdirSync(pluginPath, { recursive: true }); parent.db.deletePlugin(id, func); delete obj.plugins[plugin.shortName]; });