mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-10 12:52:39 +02:00
remove unused clearRequireCache, closes #5021
This commit is contained in:
@@ -406,31 +406,4 @@ var middleware;
|
||||
], callback);
|
||||
};
|
||||
|
||||
Plugins.clearRequireCache = function(next) {
|
||||
var cached = Object.keys(require.cache);
|
||||
async.waterfall([
|
||||
async.apply(async.map, Plugins.libraryPaths, fs.realpath),
|
||||
function(paths, next) {
|
||||
paths = paths.map(function(pluginLib) {
|
||||
var parent = path.dirname(pluginLib);
|
||||
return cached.filter(function(libPath) {
|
||||
return libPath.indexOf(parent) !== -1;
|
||||
});
|
||||
}).reduce(function(prev, cur) {
|
||||
return prev.concat(cur);
|
||||
});
|
||||
|
||||
Plugins.fireHook('filter:plugins.clearRequireCache', {paths: paths}, next);
|
||||
},
|
||||
function(data, next) {
|
||||
for (var x=0,numPaths=data.paths.length;x<numPaths;x++) {
|
||||
delete require.cache[data.paths[x]];
|
||||
}
|
||||
winston.verbose('[plugins] Plugin libraries removed from Node.js cache');
|
||||
|
||||
next();
|
||||
}
|
||||
], next);
|
||||
};
|
||||
|
||||
}(exports));
|
||||
|
||||
Reference in New Issue
Block a user