mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-22 14:08:01 +02:00
Migrations (v82,v96,v99,v136) remove dependencies (#12286)
* remove dependencys * add missing fields * CI.restart()
This commit is contained in:
@ -6,8 +6,8 @@ package migrations
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"xorm.io/xorm"
|
||||
@ -23,6 +23,12 @@ func deleteOrphanedAttachments(x *xorm.Engine) error {
|
||||
CommentID int64
|
||||
}
|
||||
|
||||
// AttachmentLocalPath returns where attachment is stored in local file
|
||||
// system based on given UUID.
|
||||
AttachmentLocalPath := func(uuid string) string {
|
||||
return path.Join(setting.AttachmentPath, uuid[0:1], uuid[1:2], uuid)
|
||||
}
|
||||
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
|
||||
@ -52,7 +58,7 @@ func deleteOrphanedAttachments(x *xorm.Engine) error {
|
||||
}
|
||||
|
||||
for _, attachment := range attachements {
|
||||
if err := os.RemoveAll(models.AttachmentLocalPath(attachment.UUID)); err != nil {
|
||||
if err := os.RemoveAll(AttachmentLocalPath(attachment.UUID)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user