Remove allowFileUploads ACP option (#8324)
* feat: allow awaitable upgrade scripts * feat: allowFileUploads removal upgrade script * refactor: remove unnecessary ACP option `allowFileUploads` * fix: updated upgrade script template to not use callback arg * fix: upgrade script as per @baris * fix: add missing await * fix: add missing awaitv1.18.x
parent
01bff2ae05
commit
6f504c4142
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
const db = require('../../database');
|
||||
const privileges = require('../../privileges');
|
||||
|
||||
module.exports = {
|
||||
name: 'Removing file upload privilege if file uploads were disabled (`allowFileUploads`)',
|
||||
timestamp: Date.UTC(2020, 4, 21),
|
||||
method: async () => {
|
||||
const allowFileUploads = parseInt(await db.getObjectField('config', 'allowFileUploads'), 10);
|
||||
if (allowFileUploads === 1) {
|
||||
await db.deleteObjectField('config', 'allowFileUploads');
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove `upload:post:file` privilege for all groups
|
||||
await privileges.categories.rescind(['upload:post:file'], 0, ['guests', 'registered-users', 'Global Moderators']);
|
||||
|
||||
// Clean up the old option from the config hash
|
||||
await db.deleteObjectField('config', 'allowFileUploads');
|
||||
},
|
||||
};
|
@ -1,17 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var db = require('../../database');
|
||||
|
||||
var async = require('async');
|
||||
var winston = require('winston');
|
||||
const db = require('../../database');
|
||||
const winston = require('winston');
|
||||
|
||||
module.exports = {
|
||||
// you should use spaces
|
||||
// the underscores are there so you can double click to select the whole thing
|
||||
name: 'User_friendly_upgrade_script_name',
|
||||
// remember, month is zero-indexed (so January is 0, December is 11)
|
||||
timestamp: Date.UTC(2019, 0, 1),
|
||||
method: function (callback) {
|
||||
timestamp: Date.UTC(2020, 0, 1),
|
||||
method: async () => {
|
||||
// Do stuff here...
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue