Fixed issue that would cause the upgrade script to completely
wipe your customJS. This was caused by meta.config not being
populated during upgrade scripts (but only when run with
./nodebb upgrade... odd.)
v1.18.x
Julian Lam 7 years ago
parent 1b8ff1f6a2
commit f6ad344ac6

@ -1,12 +1,17 @@
'use strict';
var db = require('../../database');
var meta = require('../../meta');
module.exports = {
name: 'Generate customHTML block from old customJS setting',
timestamp: Date.UTC(2017, 9, 12),
method: function (callback) {
var newHTML = meta.config.customJS;
db.getObjectField('config', 'customJS', function (err, newHTML) {
if (err) {
return callback(err);
}
var newJS = [];
// Forgive me for parsing HTML with regex...
@ -28,10 +33,13 @@ module.exports = {
// Combine newJS array
newJS = newJS.join('\n\n');
console.log('wut', newJS, 'and', newHTML);
// Write both values to config
meta.configs.setMultiple({
customHTML: newHTML,
customJS: newJS,
}, callback);
});
},
};

Loading…
Cancel
Save