Node.js based forum software built for the modern web
revert: remove heapdump
Barış Soner Uşaklıe74996fbb950
diff --git a/public/language/en-GB/admin/development/info.json b/public/language/en-GB/admin/development/info.jsonindex 40e8fded15..9834719daf 100644--- a/public/language/en-GB/admin/development/info.json+++ b/public/language/en-GB/admin/development/info.json@@ -22,6 +22,5 @@"connection-count": "Connection Count","guests": "Guests",- "info": "Info",- "heap-dump": "Heap Dump"+ "info": "Info"}\ No newline at end of filediff --git a/public/openapi/read.yaml b/public/openapi/read.yamlindex 9228ba9c7d..3ec355bd95 100644--- a/public/openapi/read.yaml+++ b/public/openapi/read.yaml@@ -174,8 +174,6 @@ paths:$ref: 'read/admin/advanced/cache.yaml'/api/admin/advanced/cache/dump:$ref: 'read/admin/advanced/cache/dump.yaml'- /api/admin/advanced/heap/dump:- $ref: 'read/admin/advanced/heap/dump.yaml'/api/admin/development/logger:$ref: 'read/admin/development/logger.yaml'/api/admin/development/info:diff --git a/public/openapi/read/admin/advanced/heap/dump.yaml b/public/openapi/read/admin/advanced/heap/dump.yamldeleted file mode 100644index 2c0465eed4..0000000000--- a/public/openapi/read/admin/advanced/heap/dump.yaml+++ /dev/null@@ -1,18 +0,0 @@-get:- tags:- - admin- summary: Get nodejs heap snapshot- description: Downloads a Node.js heap snapshot for memory analysis.- parameters: []- responses:- "200":- description: Heap snapshot file (in .heapsnapshot format)- content:- application/octet-stream:- schema:- type: string- format: binary- examples:- heapSnapshot:- summary: Example Heap Snapshot Download- description: A binary heap snapshot file.diff --git a/src/controllers/admin/info.js b/src/controllers/admin/info.jsindex e244003a1a..6f63faf8a9 100644--- a/src/controllers/admin/info.js+++ b/src/controllers/admin/info.js@@ -143,22 +143,3 @@ async function getGitInfo() {]);return { hash: hash, hashShort: hash.slice(0, 6), branch: branch };}--infoController.getHeapdump = async function (req, res) {- req.setTimeout(0);- const v8 = require('v8');- const path = require('path');- const fs = require('fs');- const filename = path.join(nconf.get('upload_path'), `heapdump-${Date.now()}.heapsnapshot`);- const stored = v8.writeHeapSnapshot(filename, {});- res.download(stored, 'heapdump.heapsnapshot', (err) => {- if (err) {- winston.error(err.stack);- }- fs.unlink(stored, (unlinkErr) => {- if (unlinkErr) {- winston.error(unlinkErr.stack);- }- });- });-};\ No newline at end of filediff --git a/src/routes/admin.js b/src/routes/admin.jsindex 94ba8e9e02..b7e751695c 100644--- a/src/routes/admin.js+++ b/src/routes/admin.js@@ -81,7 +81,6 @@ function apiRoutes(router, name, middleware, controllers) {router.get(`/api/${name}/groups/:groupname/csv`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.groups.getCSV));router.get(`/api/${name}/analytics`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.dashboard.getAnalytics));router.get(`/api/${name}/advanced/cache/dump`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.cache.dump));- router.get(`/api/${name}/advanced/heap/dump`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.info.getHeapdump));const multer = require('multer');const storage = multer.diskStorage({});diff --git a/src/views/admin/development/info.tpl b/src/views/admin/development/info.tplindex 49301f3543..493e16ac93 100644--- a/src/views/admin/development/info.tpl+++ b/src/views/admin/development/info.tpl@@ -5,12 +5,7 @@</h5><div class="card-body">- <div class="d-flex flex-wrap justify-content-between align-items-center mb-2">- <span>[[admin/development/info:nodes-responded, {nodeCount}, {timeout}]]</span>- <a href="{config.relative_path}/api/admin/advanced/heap/dump" class="btn btn-primary btn-sm">- <i class="fa fa-download"></i> [[admin/development/info:heap-dump]]- </a>- </div>+ <span>[[admin/development/info:nodes-responded, {nodeCount}, {timeout}]]</span><div class="table-responsive"><table class="table table-sm text-sm"><thead>