v1.18.x
Julian Lam 11 years ago
parent 0c4a788698
commit ab77e6767e

@ -37,18 +37,45 @@ define('forum/admin/index', function() {
});
$('.restart').on('click', function() {
bootbox.confirm('Are you sure you wish to restart NodeBB?', function(confirm) {
if (confirm) {
app.alert({
timeout: 5000,
title: 'Restarting... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is restarting.',
type: 'info'
});
$(window).one('action:reconnected', function() {
app.alertSuccess('NodeBB has successfully restarted.');
});
socket.emit('admin.restart');
}
});
});
$('.reload').on('click', function() {
app.alert({
timeout: 5000,
title: 'Restarting...',
alert_id: 'instance_reload',
title: 'Reloading... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is restarting.',
type: 'info'
type: 'info',
timeout: 5000
});
$(window).one('action:reconnected', function() {
app.alertSuccess('NodeBB has successfully restarted.');
socket.emit('admin.reload', function(err) {
if (!err) {
app.alertSuccess('NodeBB has successfully reloaded.');
} else {
app.alert({
alert_id: 'instance_reload',
title: '[[global:alert.error]]',
message: err.message,
type: 'danger'
});
}
});
socket.emit('admin.restart');
});
};

@ -3,7 +3,8 @@
var async = require('async'),
winston = require('winston'),
user = require('./user'),
groups = require('./groups');
groups = require('./groups'),
plugins = require('./plugins');
(function (Meta) {
@ -28,9 +29,13 @@ var async = require('async'),
});
};
Meta.reload = function(step) {
// 1. Reload plugins and associated routes
// 2. Minify scripts and css, update cache buster
Meta.reload = function(callback) {
plugins.reload(function() {
async.parallel([
async.apply(Meta.js.minify, false),
async.apply(Meta.css.minify)
], callback);
});
};
Meta.restart = function() {

@ -38,6 +38,10 @@ SocketAdmin.before = function(socket, method, next) {
});
};
SocketAdmin.reload = function(socket, data, callback) {
meta.reload(callback);
};
SocketAdmin.restart = function(socket, data, callback) {
meta.restart();
};

Loading…
Cancel
Save