fix: #9730, show warning if plugin is active but not installed

v1.18.x
Barış Soner Uşaklı 3 years ago
parent 096c5a5891
commit 13878e9f14

@ -13,11 +13,16 @@ const Data = module.exports;
const basePath = path.join(__dirname, '../../');
Data.getPluginPaths = async function () {
let plugins = await db.getSortedSetRange('plugins:active', 0, -1);
plugins = plugins.filter(plugin => plugin && typeof plugin === 'string')
const plugins = await db.getSortedSetRange('plugins:active', 0, -1);
const pluginPaths = plugins.filter(plugin => plugin && typeof plugin === 'string')
.map(plugin => path.join(paths.nodeModules, plugin));
const exists = await Promise.all(plugins.map(p => file.exists(p)));
const exists = await Promise.all(pluginPaths.map(file.exists));
exists.forEach((exists, i) => {
if (!exists) {
winston.warn(`[plugins] "${plugins[i]}" is active but not installed.`);
}
});
return plugins.filter((p, i) => exists[i]);
};

@ -71,7 +71,9 @@ Upgrade.appendPluginScripts = async function (files) {
});
}
} catch (e) {
winston.warn(`[upgrade/appendPluginScripts] Unable to read plugin.json for plugin \`${plugin}\`. Skipping.`);
if (e.code !== 'MODULE_NOT_FOUND') {
winston.error(e.stack);
}
}
});
return files;

Loading…
Cancel
Save