diff --git a/code/rest/dav_service.go b/code/rest/dav_service.go index 3ca6f3c..3abf8be 100644 --- a/code/rest/dav_service.go +++ b/code/rest/dav_service.go @@ -373,7 +373,7 @@ func (this *DavService) HandleDelete(w http.ResponseWriter, r *http.Request, use matter := this.matterDao.CheckWithRootByPath(subPath, user) - this.matterService.AtomicSoftDelete(r, matter, user) + this.matterService.AtomicDelete(r, matter, user) } //crate a directory diff --git a/code/rest/matter_controller.go b/code/rest/matter_controller.go index 9e6e286..36421e4 100644 --- a/code/rest/matter_controller.go +++ b/code/rest/matter_controller.go @@ -79,6 +79,7 @@ func (this *MatterController) RegisterRoutes() map[string]func(writer http.Respo routeMap["/api/matter/recovery/batch"] = this.Wrap(this.RecoveryBatch, USER_ROLE_USER) routeMap["/api/matter/delete"] = this.Wrap(this.Delete, USER_ROLE_USER) routeMap["/api/matter/delete/batch"] = this.Wrap(this.DeleteBatch, USER_ROLE_USER) + routeMap["/api/matter/clean/expired/deleted/matters"] = this.Wrap(this.CleanExpiredDeletedMatters, USER_ROLE_ADMINISTRATOR) routeMap["/api/matter/rename"] = this.Wrap(this.Rename, USER_ROLE_USER) routeMap["/api/matter/change/privacy"] = this.Wrap(this.ChangePrivacy, USER_ROLE_USER) routeMap["/api/matter/move"] = this.Wrap(this.Move, USER_ROLE_USER) @@ -449,6 +450,14 @@ func (this *MatterController) DeleteBatch(writer http.ResponseWriter, request *h return this.Success("OK") } +//manual clean expired deleted matters. +func (this *MatterController) CleanExpiredDeletedMatters(writer http.ResponseWriter, request *http.Request) *result.WebResult { + + this.matterService.CleanExpiredDeletedMatters() + + return this.Success("OK") +} + func (this *MatterController) Rename(writer http.ResponseWriter, request *http.Request) *result.WebResult { uuid := request.FormValue("uuid") diff --git a/code/rest/matter_service.go b/code/rest/matter_service.go index 36960c6..16739ba 100644 --- a/code/rest/matter_service.go +++ b/code/rest/matter_service.go @@ -1303,7 +1303,9 @@ func (this *MatterService) CleanExpiredDeletedMatters() { thenDate := time.Now() thenDate = thenDate.AddDate(0, 0, int(-preference.DeletedKeepDays)) - thenDate = util.FirstSecondOfDay(thenDate) + if preference.DeletedKeepDays != 0 { + thenDate = util.FirstSecondOfDay(thenDate) + } //first remove all the matter(not dir). this.matterDao.PageHandle("", "", "", FALSE, TRUE, &thenDate, nil, func(matter *Matter) {