plugins and themes now trigger a restart

v1.18.x
Julian Lam 11 years ago
parent c797d6251d
commit 2baa381917

@ -8,14 +8,10 @@ var fork = require('child_process').fork,
nbb.on('message', function(cmd) { nbb.on('message', function(cmd) {
if (cmd === 'nodebb:restart') { if (cmd === 'nodebb:restart') {
if (process.env.NODE_ENV !== 'development') {
nbb.on('exit', function() { nbb.on('exit', function() {
start(); start();
}); });
nbb.kill(); nbb.kill();
} else {
console.log('[app] Development Mode is on, restart aborted.');
}
} }
}); });
} }

@ -15,14 +15,6 @@ define(function() {
pluginTgl = $('.plugins li[data-plugin-id="' + status.id + '"] button'); pluginTgl = $('.plugins li[data-plugin-id="' + status.id + '"] button');
pluginTgl.html('<i class="fa fa-power-off"></i> ' + (status.active ? 'Dea' : 'A') + 'ctivate'); pluginTgl.html('<i class="fa fa-power-off"></i> ' + (status.active ? 'Dea' : 'A') + 'ctivate');
pluginTgl.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active); pluginTgl.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active);
app.alert({
alert_id: 'plugin_toggled_' + status.id,
title: 'Plugin ' + (status.active ? 'Enabled' : 'Disabled'),
message: 'You may need to restart NodeBB in order for these changes to be reflected.',
type: 'warning',
timeout: 5000
})
}); });
} else { } else {
pluginsList.append('<li><p><i>No plugins found.</i></p></li>'); pluginsList.append('<li><p><i>No plugins found.</i></p></li>');

@ -21,14 +21,6 @@ define(['forum/admin/settings'], function(Settings) {
type: themeType, type: themeType,
id: themeId, id: themeId,
src: cssSrc src: cssSrc
}, function(err) {
app.alert({
alert_id: 'admin:theme',
type: 'success',
title: 'Theme Changed',
message: 'You have successfully changed your NodeBB\'s theme. Please restart to see the changes.',
timeout: 2500
});
}); });
break; break;
} }

@ -274,12 +274,16 @@ SocketAdmin.themes.set = function(socket, data, callback) {
if(!data) { if(!data) {
return callback(new Error('invalid data')); return callback(new Error('invalid data'));
} }
meta.themes.set(data, callback); meta.themes.set(data, function() {
callback();
meta.restart()
});
}; };
SocketAdmin.plugins.toggle = function(socket, plugin_id) { SocketAdmin.plugins.toggle = function(socket, plugin_id) {
plugins.toggleActive(plugin_id, function(status) { plugins.toggleActive(plugin_id, function(status) {
socket.emit('admin.plugins.toggle', status); socket.emit('admin.plugins.toggle', status);
meta.restart();
}); });
}; };

Loading…
Cancel
Save