fix release created timezone issue

This commit is contained in:
Unknwon 2015-08-24 21:01:23 +08:00
parent 0b97290c07
commit 87152f89ba
4 changed files with 14 additions and 3 deletions

View file

@ -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())

View file

@ -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)

View file

@ -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 {

View file

@ -1 +1 @@
0.6.5.0820 Beta 0.6.5.0824 Beta