mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 06:54:04 +03:00
MC greater than 0.9.7 plugin arch fixes
This commit is contained in:
parent
e5ff461867
commit
470a313ee7
8
db.js
8
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 {
|
||||
|
@ -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];
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user