Browse Source

fix release created timezone issue

pull/1534/head
Unknwon 9 years ago
parent
commit
87152f89ba
  1. 2
      gogs.go
  2. 4
      models/models.go
  3. 9
      models/release.go
  4. 2
      templates/.VERSION

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.6.5.0820 Beta" const APP_VER = "0.6.5.0824 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

4
models/models.go

@ -133,7 +133,9 @@ func getEngine() (*xorm.Engine, error) {
if !EnableSQLite3 { if !EnableSQLite3 {
return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type) return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type)
} }
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm) if err := os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm); err != nil {
return nil, fmt.Errorf("Fail to create directories: %v", err)
}
cnnstr = "file:" + DbCfg.Path + "?cache=shared&mode=rwc" cnnstr = "file:" + DbCfg.Path + "?cache=shared&mode=rwc"
default: default:
return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type) return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type)

9
models/release.go

@ -10,6 +10,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-xorm/xorm"
"github.com/gogits/gogs/modules/git" "github.com/gogits/gogs/modules/git"
) )
@ -37,6 +39,13 @@ type Release struct {
Created time.Time `xorm:"CREATED"` Created time.Time `xorm:"CREATED"`
} }
func (r *Release) AfterSet(colName string, _ xorm.Cell) {
switch colName {
case "created":
r.Created = regulateTimeZone(r.Created)
}
}
// IsReleaseExist returns true if release with given tag name already exists. // IsReleaseExist returns true if release with given tag name already exists.
func IsReleaseExist(repoId int64, tagName string) (bool, error) { func IsReleaseExist(repoId int64, tagName string) (bool, error) {
if len(tagName) == 0 { if len(tagName) == 0 {

2
templates/.VERSION

@ -1 +1 @@
0.6.5.0820 Beta 0.6.5.0824 Beta
Loading…
Cancel
Save