Skip to content

Node.js based forum software built for the modern web

added restart button to ACP (!!)

Julian Lam7760a6b2074b
diff --git a/public/src/forum/admin/index.js b/public/src/forum/admin/index.js
index 914676115d..1870884328 100644
--- a/public/src/forum/admin/index.js
+++ b/public/src/forum/admin/index.js
@@ -31,6 +31,10 @@ define(function() {
checkEl.append('<p>A new version (v' + latestVersion + ') has been released. Consider upgrading your NodeBB.</p>');
}
});
+
+ $('.restart').on('click', function() {
+ socket.emit('admin.restart');
+ });
};
Admin.updateRoomUsage = function(err, data) {
diff --git a/public/templates/admin/index.tpl b/public/templates/admin/index.tpl
index a6b8db55be..2d548c459c 100644
--- a/public/templates/admin/index.tpl
+++ b/public/templates/admin/index.tpl
@@ -22,6 +22,9 @@
<p>
Always make sure that your <strong>NodeBB</strong> is up to date for the latest security patches and bug fixes.
</p>
+ <p class="pull-right">
+ <button class="btn btn-warning restart">Restart NodeBB</button>
+ </p>
</div>
</div>
</div>
diff --git a/src/meta.js b/src/meta.js
index c1eb612744..419f293648 100644
--- a/src/meta.js
+++ b/src/meta.js
@@ -336,4 +336,12 @@ var fs = require('fs'),
db.getFileName(callback);
}
};
+
+ Meta.restart = function() {
+ if (process.send) {
+ process.send('nodebb:restart');
+ } else {
+ winston.error('[meta.restart] Could not restart, are you sure NodeBB was started with `./nodebb start`?');
+ }
+ };
}(exports));
diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js
index 21f3d8bf11..3f674f2d65 100644
--- a/src/socket.io/admin.js
+++ b/src/socket.io/admin.js
@@ -31,6 +31,10 @@ SocketAdmin.before = function(socket, next) {
});
};
+SocketAdmin.restart = function(socket, data, callback) {
+ meta.restart();
+};
+
/* Topics */
SocketAdmin.topics = {};