Added server hook action:analytics.increment

v1.18.x
Dravere 7 years ago committed by Julian Lam
parent b71d64e8c3
commit 956aa55253

@ -7,6 +7,7 @@ var nconf = require('nconf');
var crypto = require('crypto'); var crypto = require('crypto');
var db = require('./database'); var db = require('./database');
var plugins = require('./plugins');
var Analytics = module.exports; var Analytics = module.exports;
@ -35,6 +36,8 @@ new cronJob('*/10 * * * * *', function () {
Analytics.increment = function (keys, callback) { Analytics.increment = function (keys, callback) {
keys = Array.isArray(keys) ? keys : [keys]; keys = Array.isArray(keys) ? keys : [keys];
plugins.fireHook('action:analytics.increment', { keys: keys });
keys.forEach(function (key) { keys.forEach(function (key) {
counters[key] = counters[key] || 0; counters[key] = counters[key] || 0;
counters[key] += 1; counters[key] += 1;

Loading…
Cancel
Save