|
@@ -17,6 +17,7 @@ import loggerFactory from '~/utils/logger';
|
|
|
import { projectRoot } from '~/utils/project-dir-utils';
|
|
import { projectRoot } from '~/utils/project-dir-utils';
|
|
|
|
|
|
|
|
import Activity from '../models/activity';
|
|
import Activity from '../models/activity';
|
|
|
|
|
+import PageOperation, { PageActionType } from '../models/page-operation';
|
|
|
import PageRedirect from '../models/page-redirect';
|
|
import PageRedirect from '../models/page-redirect';
|
|
|
import UserGroup from '../models/user-group';
|
|
import UserGroup from '../models/user-group';
|
|
|
import AclService from '../service/acl';
|
|
import AclService from '../service/acl';
|
|
@@ -424,6 +425,9 @@ Crowi.prototype.start = async function() {
|
|
|
|
|
|
|
|
await this.init();
|
|
await this.init();
|
|
|
await this.buildServer();
|
|
await this.buildServer();
|
|
|
|
|
+ // cleanup if PageOperationDocuments exist
|
|
|
|
|
+ await this.cleanupPageOperation();
|
|
|
|
|
+
|
|
|
|
|
|
|
|
const { express, configManager } = this;
|
|
const { express, configManager } = this;
|
|
|
|
|
|
|
@@ -681,8 +685,6 @@ Crowi.prototype.setupPageService = async function() {
|
|
|
}
|
|
}
|
|
|
if (this.pageOperationService == null) {
|
|
if (this.pageOperationService == null) {
|
|
|
this.pageOperationService = new PageOperationService(this);
|
|
this.pageOperationService = new PageOperationService(this);
|
|
|
- // TODO: Remove this code when resuming feature is implemented
|
|
|
|
|
- await this.pageOperationService.init();
|
|
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -730,4 +732,13 @@ Crowi.prototype.setupSlackIntegrationService = async function() {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+Crowi.prototype.cleanupPageOperation = async function() {
|
|
|
|
|
+ if (PageOperation == null) return;
|
|
|
|
|
+
|
|
|
|
|
+ const excludeList = [PageActionType.Rename]; // list of ActionType to avoid being cleaned up
|
|
|
|
|
+ await PageOperation.cleanup(excludeList);
|
|
|
|
|
+ await PageOperation.markAsFailure();
|
|
|
|
|
+ logger.info('PageOperation cleaned up');
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
export default Crowi;
|
|
export default Crowi;
|