Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const os = require('os');
const execSync = require('child_process').execSync;
const fs = require('fs');
const semver = require('semver');
const config = require('../src/config');
const currentVersion = require('../package').version;
const {restoreDBs, restoreConfigs, INSTALLATION_VARIABLES_FILE} = require('./util');

Expand All @@ -41,6 +42,10 @@ function postinstall() {
console.log('upgrading from version <= 1.0.30 :');
updateEncryptionMethod();
}
if (semver.satisfies(prevVersion, '<=1.0.37')) {
console.log('upgrading from version <= 1.0.37 :');
updateLogName();
}

fs.unlinkSync(INSTALLATION_VARIABLES_FILE);
} catch (e) {
Expand Down Expand Up @@ -151,6 +156,24 @@ function updateEncryptionMethod() {
updateEncryptionMethodForEmailService(prodConfig, decryptTextVer30);
}

function updateLogName() {
console.log(' updating log name in ');
const dirname = config.get('Service:LogsDirectory')

if (fs.existsSync(dirname)) {
fs.readdirSync(dirname).forEach(file => {
const path = dirname + '/' + file
if (fs.existsSync(path)) {
fs.unlinkSync(path, function(err) {
if (err) return console.log(err);
console.log('log deleted successfully');
})
}
});
}

}

module.exports = {
postinstall: postinstall
};