mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
861 B
27 lines
861 B
3 years ago
|
'use strict';
|
||
|
|
||
|
const config = require(__dirname+'/../config.js')
|
||
|
, fs = require('fs-extra')
|
||
|
, uploadDirectory = require(__dirname+'/../helpers/files/uploadDirectory.js');
|
||
|
|
||
|
module.exports = async(db, redis) => {
|
||
|
console.log('Adding assets');
|
||
|
await fs.ensureDir(`${uploadDirectory}/asset/`);
|
||
|
const template = require(__dirname+'/../configs/template.js.example');
|
||
|
await db.collection('globalsettings').updateOne({ _id: 'globalsettings' }, {
|
||
|
'$set': {
|
||
|
'globalLimits.assetFiles': template.globalLimits.assetFiles,
|
||
|
'globalLimits.assetFilesSize': template.globalLimits.assetFilesSize,
|
||
|
},
|
||
|
});
|
||
|
await db.collection('boards').updateMany({}, {
|
||
|
'$set': {
|
||
|
'assets': [],
|
||
|
},
|
||
|
});
|
||
|
console.log('Cleared boards cache');
|
||
|
await redis.deletePattern('board:*');
|
||
|
console.log('Cleared globalsettings cache');
|
||
|
await redis.deletePattern('globalsettings');
|
||
|
};
|