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

@ -37,9 +37,11 @@ define('forum/admin/index', function() {
}); });
$('.restart').on('click', function() { $('.restart').on('click', function() {
bootbox.confirm('Are you sure you wish to restart NodeBB?', function(confirm) {
if (confirm) {
app.alert({ app.alert({
timeout: 5000, timeout: 5000,
title: 'Restarting...', title: 'Restarting... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is restarting.', message: 'NodeBB is restarting.',
type: 'info' type: 'info'
}); });
@ -49,6 +51,31 @@ define('forum/admin/index', function() {
}); });
socket.emit('admin.restart'); socket.emit('admin.restart');
}
});
});
$('.reload').on('click', function() {
app.alert({
alert_id: 'instance_reload',
title: 'Reloading... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is restarting.',
type: 'info',
timeout: 5000
});
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'
});
}
});
}); });
}; };

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

Loading…
Cancel
Save