mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Migrations (v82,v96,v99,v136) remove dependencies (#12286)
* remove dependencys * add missing fields * CI.restart()
This commit is contained in:
parent
8e20daaede
commit
2753d72773
4 changed files with 35 additions and 11 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue