mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 22:25:52 -05: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) {
|
if (obj.pluginsActive) {
|
||||||
obj.addPlugin = function (plugin, func) { plugin.type = 'plugin'; obj.pluginsfile.insertOne(plugin, func); }; // Add a plugin
|
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.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.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.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.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.updatePlugin = function (id, args, func) { delete args._id; id = require('mongodb').ObjectId(id); obj.pluginsfile.updateOne({ _id: id }, { $set: args }, func); };
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -507,9 +507,8 @@ module.exports.pluginHandler = function (parent) {
|
|||||||
obj.removePlugin = function (id, func) {
|
obj.removePlugin = function (id, func) {
|
||||||
parent.db.getPlugin(id, function (err, docs) {
|
parent.db.getPlugin(id, function (err, docs) {
|
||||||
var plugin = docs[0];
|
var plugin = docs[0];
|
||||||
var rimraf = require('rimraf');
|
|
||||||
let pluginPath = obj.parent.path.join(obj.pluginPath, plugin.shortName);
|
let pluginPath = obj.parent.path.join(obj.pluginPath, plugin.shortName);
|
||||||
rimraf.sync(pluginPath);
|
obj.fs.rmdirSync(pluginPath, { recursive: true });
|
||||||
parent.db.deletePlugin(id, func);
|
parent.db.deletePlugin(id, func);
|
||||||
delete obj.plugins[plugin.shortName];
|
delete obj.plugins[plugin.shortName];
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user