|
|
|
@ -9,6 +9,8 @@ var versions = require('../../admin/versions');
|
|
|
|
|
var db = require('../../database');
|
|
|
|
|
var meta = require('../../meta');
|
|
|
|
|
var plugins = require('../../plugins');
|
|
|
|
|
var user = require('../../user');
|
|
|
|
|
var utils = require('../../utils');
|
|
|
|
|
|
|
|
|
|
var dashboardController = module.exports;
|
|
|
|
|
|
|
|
|
@ -51,6 +53,9 @@ dashboardController.get = function (req, res, next) {
|
|
|
|
|
next(null, err ? null : result);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
lastrestart: function (next) {
|
|
|
|
|
getLastRestart(next);
|
|
|
|
|
},
|
|
|
|
|
}, next);
|
|
|
|
|
},
|
|
|
|
|
function (results) {
|
|
|
|
@ -65,6 +70,7 @@ dashboardController.get = function (req, res, next) {
|
|
|
|
|
notices: results.notices,
|
|
|
|
|
stats: results.stats,
|
|
|
|
|
canRestart: !!process.send,
|
|
|
|
|
lastrestart: results.lastrestart,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
], next);
|
|
|
|
@ -128,3 +134,24 @@ function getGlobalField(field, callback) {
|
|
|
|
|
callback(err, parseInt(count, 10) || 0);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getLastRestart(callback) {
|
|
|
|
|
var lastrestart;
|
|
|
|
|
async.waterfall([
|
|
|
|
|
function (next) {
|
|
|
|
|
db.getObject('lastrestart', next);
|
|
|
|
|
},
|
|
|
|
|
function (_lastrestart, next) {
|
|
|
|
|
lastrestart = _lastrestart;
|
|
|
|
|
if (!lastrestart) {
|
|
|
|
|
return callback();
|
|
|
|
|
}
|
|
|
|
|
user.getUserData(lastrestart.uid, next);
|
|
|
|
|
},
|
|
|
|
|
function (userData, next) {
|
|
|
|
|
lastrestart.user = userData;
|
|
|
|
|
lastrestart.timestampISO = utils.toISOString(lastrestart.timestamp);
|
|
|
|
|
next(null, lastrestart);
|
|
|
|
|
},
|
|
|
|
|
], callback);
|
|
|
|
|
}
|
|
|
|
|