use of org.craftercms.studio.api.v1.constant.GitRepositories in project studio by craftercms.
the class RepositoryManagementServiceInternalImpl method unlockRepository.
@Override
public boolean unlockRepository(String siteId, GitRepositories repositoryType) throws CryptoException {
boolean toRet = false;
GitRepositoryHelper helper = GitRepositoryHelper.getHelper(studioConfiguration, securityService, userServiceInternal, encryptor, generalLockService, retryingRepositoryOperationFacade);
Repository repo = helper.getRepository(siteId, repositoryType);
if (Objects.nonNull(repo)) {
toRet = FileUtils.deleteQuietly(Paths.get(repo.getDirectory().getAbsolutePath(), LOCK_FILE).toFile());
}
return toRet;
}
use of org.craftercms.studio.api.v1.constant.GitRepositories in project studio by craftercms.
the class GitContentRepository method cleanup.
protected void cleanup(String siteId, GitRepositories repository) {
try {
GitRepositoryHelper helper = GitRepositoryHelper.getHelper(studioConfiguration, securityService, userServiceInternal, encryptor, generalLockService, retryingRepositoryOperationFacade);
Repository sandbox = helper.getRepository(siteId, repository);
try (Git git = new Git(sandbox)) {
GarbageCollectCommand garbageCollectCommand = git.gc();
retryingRepositoryOperationFacade.call(garbageCollectCommand);
}
} catch (Exception e) {
logger.warn("Error cleaning up repository for site " + siteId, e);
}
}
Aggregations