mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-08 05:02:38 +09:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d876ab1c8 | ||
|
|
f58715d903 | ||
|
|
81072af8ce | ||
|
|
1d7a855d66 |
@@ -389,7 +389,7 @@ steps:
|
|||||||
|
|
||||||
- name: static
|
- name: static
|
||||||
pull: always
|
pull: always
|
||||||
image: techknowlogick/xgo:latest
|
image: techknowlogick/xgo:go-1.13.x
|
||||||
commands:
|
commands:
|
||||||
- export PATH=$PATH:$GOPATH/bin
|
- export PATH=$PATH:$GOPATH/bin
|
||||||
- make generate
|
- make generate
|
||||||
@@ -491,7 +491,7 @@ steps:
|
|||||||
|
|
||||||
- name: static
|
- name: static
|
||||||
pull: always
|
pull: always
|
||||||
image: techknowlogick/xgo:latest
|
image: techknowlogick/xgo:go-1.13.x
|
||||||
commands:
|
commands:
|
||||||
- export PATH=$PATH:$GOPATH/bin
|
- export PATH=$PATH:$GOPATH/bin
|
||||||
- make generate
|
- make generate
|
||||||
|
|||||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -4,6 +4,17 @@ This changelog goes through all the changes that have been made in each release
|
|||||||
without substantial changes to our git log; to see the highlights of what has
|
without substantial changes to our git log; to see the highlights of what has
|
||||||
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||||
|
|
||||||
|
## [1.10.6](https://github.com/go-gitea/gitea/releases/tag/v1.10.6) - 2020-03-10
|
||||||
|
|
||||||
|
This is a re-tag version of v1.10.5 and also explicitly built with Go 1.13.
|
||||||
|
|
||||||
|
WARNING: v1.10.5 is incorrectly tagged targeting 1.12-dev and should **not** be used.
|
||||||
|
|
||||||
|
## [1.10.5](https://github.com/go-gitea/gitea/releases/tag/v1.10.5) - 2020-03-06
|
||||||
|
|
||||||
|
* BUGFIXES
|
||||||
|
* Fix release attachments being deleted while upgrading (#10572) (#10574)
|
||||||
|
|
||||||
## [1.10.4](https://github.com/go-gitea/gitea/releases/tag/v1.10.4) - 2020-02-16
|
## [1.10.4](https://github.com/go-gitea/gitea/releases/tag/v1.10.4) - 2020-02-16
|
||||||
|
|
||||||
* FEATURE
|
* FEATURE
|
||||||
|
|||||||
@@ -26,23 +26,38 @@ func deleteOrphanedAttachments(x *xorm.Engine) error {
|
|||||||
sess := x.NewSession()
|
sess := x.NewSession()
|
||||||
defer sess.Close()
|
defer sess.Close()
|
||||||
|
|
||||||
err := sess.BufferSize(setting.Database.IterateBufferSize).
|
var limit = setting.Database.IterateBufferSize
|
||||||
Where("`issue_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))").Cols("uuid").
|
if limit <= 0 {
|
||||||
Iterate(new(Attachment),
|
limit = 50
|
||||||
func(idx int, bean interface{}) error {
|
}
|
||||||
attachment := bean.(*Attachment)
|
|
||||||
|
|
||||||
|
for {
|
||||||
|
attachements := make([]Attachment, 0, limit)
|
||||||
|
if err := sess.Where("`issue_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))").
|
||||||
|
Cols("id, uuid").Limit(limit).
|
||||||
|
Asc("id").
|
||||||
|
Find(&attachements); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(attachements) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var ids = make([]int64, 0, limit)
|
||||||
|
for _, attachment := range attachements {
|
||||||
|
ids = append(ids, attachment.ID)
|
||||||
|
}
|
||||||
|
if _, err := sess.In("id", ids).Delete(new(Attachment)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, attachment := range attachements {
|
||||||
if err := os.RemoveAll(models.AttachmentLocalPath(attachment.UUID)); err != nil {
|
if err := os.RemoveAll(models.AttachmentLocalPath(attachment.UUID)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := sess.ID(attachment.ID).NoAutoCondition().Delete(attachment)
|
|
||||||
return err
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
if len(attachements) < limit {
|
||||||
return sess.Commit()
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user