|
@@ -687,14 +687,16 @@ module.exports = (crowi) => {
|
|
|
// TODO: use socket conn to show progress
|
|
// TODO: use socket conn to show progress
|
|
|
router.post('/v5-schema-migration', accessTokenParser, loginRequired, adminRequired, csrf, validator.v5PageMigration, apiV3FormValidator, async(req, res) => {
|
|
router.post('/v5-schema-migration', accessTokenParser, loginRequired, adminRequired, csrf, validator.v5PageMigration, apiV3FormValidator, async(req, res) => {
|
|
|
const { action } = req.body;
|
|
const { action } = req.body;
|
|
|
|
|
+ const isV5Compatible = crowi.configManager.getConfig('crowi', 'app:isV5Compatible');
|
|
|
|
|
|
|
|
switch (action) {
|
|
switch (action) {
|
|
|
case 'upgrade':
|
|
case 'upgrade':
|
|
|
-
|
|
|
|
|
try {
|
|
try {
|
|
|
- const Page = crowi.model('Page');
|
|
|
|
|
- // not await
|
|
|
|
|
- crowi.pageService.v5RecursiveMigration(Page.GRANT_PUBLIC);
|
|
|
|
|
|
|
+ if (!isV5Compatible) {
|
|
|
|
|
+ const Page = crowi.model('Page');
|
|
|
|
|
+ // not await
|
|
|
|
|
+ crowi.pageService.v5RecursiveMigration(Page.GRANT_PUBLIC);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
logger.error('Error\n', err);
|
|
logger.error('Error\n', err);
|
|
@@ -707,7 +709,6 @@ module.exports = (crowi) => {
|
|
|
return res.apiv3Err(new ErrorV3('This action is not supported.', 'not_supported'), 400);
|
|
return res.apiv3Err(new ErrorV3('This action is not supported.', 'not_supported'), 400);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const isV5Compatible = crowi.configManager.getConfig('crowi', 'app:isV5Compatible');
|
|
|
|
|
return res.apiv3({ isV5Compatible });
|
|
return res.apiv3({ isV5Compatible });
|
|
|
});
|
|
});
|
|
|
|
|
|