summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-08-27 16:39:36 +0800
committerUnknwon <joe2010xtmf@163.com>2014-08-27 16:39:36 +0800
commit9baf2b38d025eaf1d9bbb10a4616c71813ea7054 (patch)
treea6b8f31a638f2ca286e2c99e1c43c48e59e9c9c6 /modules
parent50de06056be67ab8433fa796608e38004f2e8733 (diff)
downloadgitea-9baf2b38d025eaf1d9bbb10a4616c71813ea7054.tar.gz
gitea-9baf2b38d025eaf1d9bbb10a4616c71813ea7054.zip
Bug fix on organization
Diffstat (limited to 'modules')
-rw-r--r--modules/log/file.go10
-rw-r--r--modules/log/log.go8
-rw-r--r--modules/middleware/org.go3
3 files changed, 17 insertions, 4 deletions
diff --git a/modules/log/file.go b/modules/log/file.go
index 52a2f68c73..e9402815f0 100644
--- a/modules/log/file.go
+++ b/modules/log/file.go
@@ -210,13 +210,19 @@ func (w *FileLogWriter) DoRotate() error {
func (w *FileLogWriter) deleteOldLog() {
dir := filepath.Dir(w.Filename)
- filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
+ filepath.Walk(dir, func(path string, info os.FileInfo, err error) (returnErr error) {
+ defer func() {
+ if r := recover(); r != nil {
+ returnErr = fmt.Errorf("Unable to delete old log '%s', error: %+v", path, r)
+ }
+ }()
+
if !info.IsDir() && info.ModTime().Unix() < (time.Now().Unix()-60*60*24*w.Maxdays) {
if strings.HasPrefix(filepath.Base(path), filepath.Base(w.Filename)) {
os.Remove(path)
}
}
- return nil
+ return returnErr
})
}
diff --git a/modules/log/log.go b/modules/log/log.go
index 00f777e72a..8f4de1e1e9 100644
--- a/modules/log/log.go
+++ b/modules/log/log.go
@@ -225,7 +225,9 @@ func (l *Logger) StartLogger() {
select {
case bm := <-l.msg:
for _, l := range l.outputs {
- l.WriteMsg(bm.msg, bm.skip, bm.level)
+ if err := l.WriteMsg(bm.msg, bm.skip, bm.level); err != nil {
+ fmt.Println("ERROR, unable to WriteMsg:", err)
+ }
}
case <-l.quit:
return
@@ -247,7 +249,9 @@ func (l *Logger) Close() {
if len(l.msg) > 0 {
bm := <-l.msg
for _, l := range l.outputs {
- l.WriteMsg(bm.msg, bm.skip, bm.level)
+ if err := l.WriteMsg(bm.msg, bm.skip, bm.level); err != nil {
+ fmt.Println("ERROR, unable to WriteMsg:", err)
+ }
}
} else {
break
diff --git a/modules/middleware/org.go b/modules/middleware/org.go
index ee4460b274..7bb24ab7ee 100644
--- a/modules/middleware/org.go
+++ b/modules/middleware/org.go
@@ -56,6 +56,9 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Org.IsMember = true
}
}
+ } else {
+ // Fake data.
+ ctx.Data["SignedUser"] = &models.User{}
}
if (requireMember && !ctx.Org.IsMember) ||
(requireOwner && !ctx.Org.IsOwner) {