Windshaft-cartodb/lib/backends/stats.js

19 lines
506 B
JavaScript
Raw Normal View History

'use strict';
var layerStats = require('./layer-stats/factory');
2019-10-22 01:07:24 +08:00
function StatsBackend () {
2017-05-10 00:24:24 +08:00
}
module.exports = StatsBackend;
2019-10-22 01:07:24 +08:00
StatsBackend.prototype.getStats = function (mapConfig, dbConnection, callback) {
var enabledFeatures = global.environment.enabledFeatures;
2019-10-22 01:07:24 +08:00
var layerStatsEnabled = enabledFeatures ? enabledFeatures.layerStats : false;
if (layerStatsEnabled) {
layerStats().getStats(mapConfig, dbConnection, callback);
} else {
return callback(null, []);
}
};