versions() added postgresql

This commit is contained in:
Sebastian Hildebrandt 2018-11-17 22:27:25 +01:00
parent de097b5667
commit 7ae7f876d5

View File

@ -297,11 +297,12 @@ function versions(callback) {
nginx: '',
php: '',
docker: '',
postfix: ''
postfix: '',
postgresql: ''
};
let functionProcessed = (function () {
let totalFunctions = 16;
let totalFunctions = 17;
return function () {
if (--totalFunctions === 0) {
if (callback) {
@ -453,6 +454,14 @@ function versions(callback) {
}
functionProcessed();
});
exec('postgres -V', function (error, stdout) {
if (!error) {
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
result.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
result.mongodb = (result.mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
}
functionProcessed();
});
} catch (e) {
if (callback) { callback(result); }
resolve(result);