use of org.craftercms.studio.api.v2.deployment.Deployer in project studio by craftercms.
the class SiteServiceImpl method deleteSite.
@Override
@ValidateParams
public boolean deleteSite(@ValidateStringParam(name = "siteId") String siteId) {
boolean success = true;
logger.debug("Deleting site:" + siteId);
try {
enablePublishing(siteId, false);
} catch (SiteNotFoundException e) {
success = false;
logger.error("Failed to stop publishing for site:" + siteId, e);
}
try {
logger.debug("Deleting Deployer targets");
deployer.deleteTargets(siteId);
} catch (Exception e) {
success = false;
logger.error("Failed to delete the Deployer target for sites:" + siteId, e);
}
try {
success = success && destroySitePreviewContext(siteId);
} catch (Exception e) {
success = false;
logger.error("Failed to destroy the preview context for site:" + siteId, e);
}
try {
logger.debug("Deleting repo");
contentRepository.deleteSite(siteId);
} catch (Exception e) {
success = false;
logger.error("Failed to delete the repository for site:" + siteId, e);
}
try {
// delete database records
logger.debug("Deleting database records");
SiteFeed siteFeed = getSite(siteId);
siteFeedMapper.deleteSite(siteId);
dependencyService.deleteSiteDependencies(siteId);
deploymentService.deleteDeploymentDataForSite(siteId);
objectStateService.deleteObjectStatesForSite(siteId);
objectMetadataManager.deleteObjectMetadataForSite(siteId);
dmPageNavigationOrderService.deleteSequencesForSite(siteId);
contentRepository.deleteGitLogForSite(siteId);
contentRepository.removeRemoteRepositoriesForSite(siteId);
auditServiceInternal.deleteAuditLogForSite(siteFeed.getId());
insertDeleteSiteAuditLog(siteId, siteFeed.getName());
} catch (Exception e) {
success = false;
logger.error("Failed to delete the database for site:" + siteId, e);
}
return success;
}
Aggregations