remove deprecated method

v1.18.x
Barış Soner Uşaklı 7 years ago
parent 57b7c7ede4
commit 625ab1a46b

@ -9,7 +9,6 @@ var express = require('express');
var nconf = require('nconf');
var hotswap = require('./hotswap');
var file = require('./file');
var app;
var middleware;
@ -138,56 +137,6 @@ Plugins.reloadRoutes = function (callback) {
});
};
var themeNamePattern = /^(@.*?\/)?nodebb-theme-.*$/;
// DEPRECATED: remove in v1.8.0
Plugins.getTemplates = function (callback) {
var templates = {};
var tplName;
winston.warn('[deprecated] Plugins.getTemplates is DEPRECATED to be removed in v1.8.0');
Plugins.data.getActive(function (err, plugins) {
if (err) {
return callback(err);
}
async.eachSeries(plugins, function (plugin, next) {
if (plugin.templates || themeNamePattern.test(plugin.id)) {
winston.verbose('[plugins] Loading templates (' + plugin.id + ')');
var templatesPath = path.join(__dirname, '../node_modules', plugin.id, plugin.templates || 'templates');
file.walk(templatesPath, function (err, pluginTemplates) {
if (pluginTemplates) {
pluginTemplates.forEach(function (pluginTemplate) {
if (pluginTemplate.endsWith('.tpl')) {
tplName = '/' + pluginTemplate.replace(templatesPath, '').substring(1);
if (templates.hasOwnProperty(tplName)) {
winston.verbose('[plugins] ' + tplName + ' replaced by ' + plugin.id);
}
templates[tplName] = pluginTemplate;
} else {
winston.warn('[plugins] Skipping ' + pluginTemplate + ' by plugin ' + plugin.id);
}
});
} else if (err) {
winston.error(err);
} else {
winston.warn('[plugins/' + plugin.id + '] A templates directory was defined for this plugin, but was not found.');
}
next(false);
});
} else {
next(false);
}
}, function (err) {
callback(err, templates);
});
});
};
Plugins.get = function (id, callback) {
var url = (nconf.get('registry') || 'https://packages.nodebb.org') + '/api/v1/plugins/' + id;
@ -228,6 +177,7 @@ Plugins.list = function (matching, callback) {
};
Plugins.normalise = function (apiReturn, callback) {
var themeNamePattern = /^(@.*?\/)?nodebb-theme-.*$/;
var pluginMap = {};
var dependencies = require(path.join(nconf.get('base_dir'), 'package.json')).dependencies;
apiReturn = Array.isArray(apiReturn) ? apiReturn : [];

Loading…
Cancel
Save