mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	#2558 delete local wiki copy when rename repo and user
This commit is contained in:
		| @@ -5,12 +5,15 @@ | ||||
| package models | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"strings" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/Unknwon/com" | ||||
|  | ||||
| 	"github.com/gogits/gogs/modules/base" | ||||
| 	"github.com/gogits/gogs/modules/log" | ||||
| ) | ||||
|  | ||||
| type NoticeType int | ||||
| @@ -47,6 +50,18 @@ func CreateRepositoryNotice(desc string) error { | ||||
| 	return CreateNotice(NOTICE_REPOSITORY, desc) | ||||
| } | ||||
|  | ||||
| // RemoveAllWithNotice removes all directories in given path and | ||||
| // creates a system notice when error occurs. | ||||
| func RemoveAllWithNotice(title, path string) { | ||||
| 	if err := os.RemoveAll(path); err != nil { | ||||
| 		desc := fmt.Sprintf("%s [%s]: %v", title, path, err) | ||||
| 		log.Warn(desc) | ||||
| 		if err = CreateRepositoryNotice(desc); err != nil { | ||||
| 			log.Error(4, "CreateRepositoryNotice: %v", err) | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // CountNotices returns number of notices. | ||||
| func CountNotices() int64 { | ||||
| 	count, _ := x.Count(new(Notice)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user