This commit is contained in:
franklin 2014-10-01 15:02:45 +02:00
commit f2c1053fb8
4 changed files with 29 additions and 25 deletions

View File

@ -59,7 +59,7 @@ func log(msg string, level int) string {
}
func SetLogLevel(level int) bool {
if level > LOG_LEVEL_ERROR && level <= LOG_LEVEL_DEBUG {
if level >= LOG_LEVEL_ERROR && level <= LOG_LEVEL_DEBUG {
logLevel = level
return true
} else {

View File

@ -147,7 +147,7 @@ func (node *RepoNode) IsOneOfTheseMimeTypes(mimeTypes []string) bool {
}
func (node *RepoNode) CanBeAccessedByGroups(groups []string) bool {
if len(groups) == 0 {
if len(groups) == 0 || len(node.Groups) == 0 {
return true
} else {
// @todo is there sth like in_array ... or some array intersection

View File

@ -214,18 +214,7 @@ func wireAliases(directory map[string]*content.RepoNode) {
}
}
func (repo *Repo) Update() *responses.Update {
updateResponse := responses.NewUpdate()
newNode := content.NewRepoNode()
startTimeRepo := time.Now()
ok, err := utils.Get(repo.server, newNode)
updateResponse.Stats.RepoRuntime = time.Now().Sub(startTimeRepo).Seconds()
startTimeOwn := time.Now()
updateResponse.Success = ok
if ok {
func (repo *Repo) Load(newNode *content.RepoNode) {
newNode.WireParents()
newDirectory := make(map[string]*content.RepoNode)
@ -240,7 +229,20 @@ func (repo *Repo) Update() *responses.Update {
repo.Node = newNode
repo.Directory = newDirectory
repo.URIDirectory = newURIDirectory
}
func (repo *Repo) Update() *responses.Update {
updateResponse := responses.NewUpdate()
newNode := content.NewRepoNode()
startTimeRepo := time.Now()
ok, err := utils.Get(repo.server, newNode)
updateResponse.Stats.RepoRuntime = time.Now().Sub(startTimeRepo).Seconds()
startTimeOwn := time.Now()
updateResponse.Success = ok
if ok {
repo.Load(newNode)
updateResponse.Stats.NumberOfNodes = len(repo.Directory)
updateResponse.Stats.NumberOfURIs = len(repo.URIDirectory)
} else {

View File

@ -1,10 +1,12 @@
package requests
type Env struct {
Defaults struct {
type Defaults struct {
Region string `json:"region"`
Language string `json:"language"`
} `json:"defaults"`
}
type Env struct {
Defaults *Defaults `json:"defaults"`
Groups []string `json:"groups"`
State string
Data interface{} `json:"data"`