From 2f123970e646e012a0be58387b963f79cdf977a0 Mon Sep 17 00:00:00 2001 From: johnyma22 Date: Fri, 2 Nov 2012 15:21:12 +0000 Subject: [PATCH] Make express restart - I think this reloads settings --- src/node/hooks/express/adminsettings.js | 18 +++++------------- src/static/js/admin/settings.js | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/node/hooks/express/adminsettings.js b/src/node/hooks/express/adminsettings.js index 2a6b590d..db4df750 100644 --- a/src/node/hooks/express/adminsettings.js +++ b/src/node/hooks/express/adminsettings.js @@ -1,6 +1,7 @@ var path = require('path'); var eejs = require('ep_etherpad-lite/node/eejs'); var installer = require('ep_etherpad-lite/static/js/pluginfw/installer'); +var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks"); var fs = require('fs'); exports.expressCreateServer = function (hook_name, args, cb) { @@ -41,20 +42,11 @@ exports.socketio = function (hook_name, args, cb) { }); }); -/* - socket.on("install", function (plugin_name) { - socket.emit("progress", {progress:0, message:'Downloading and installing ' + plugin_name + "..."}); - installer.install(plugin_name, function (progress) { - socket.emit("progress", progress); - }); + socket.on("restartServer", function () { + console.log("Admin request to restart server through a socket on /admin/settings"); + hooks.aCallAll("restartServer", {}, function () {}); + }); - socket.on("uninstall", function (plugin_name) { - socket.emit("progress", {progress:0, message:'Uninstalling ' + plugin_name + "..."}); - installer.uninstall(plugin_name, function (progress) { - socket.emit("progress", progress); - }); - }); -*/ }); } diff --git a/src/static/js/admin/settings.js b/src/static/js/admin/settings.js index 5be25d87..0c9edb1a 100644 --- a/src/static/js/admin/settings.js +++ b/src/static/js/admin/settings.js @@ -38,7 +38,7 @@ $(document).ready(function () { /* Tell Etherpad Server to restart */ $('#restartEtherpad').on('click', function(){ - socket.emit("restartEtherpad"); + socket.emit("restartServer"); }); socket.on('saveprogress', function(progress){