-
+
-
+
@@ -43,7 +43,7 @@
{{end}}
{{end}}
-
-
+
+
{{range .ItemList}}
diff --git a/templates/panel_themes_widgets_widget.html b/templates/panel_themes_widgets_widget.html
index be9155eb..261a1f33 100644
--- a/templates/panel_themes_widgets_widget.html
+++ b/templates/panel_themes_widgets_widget.html
@@ -14,8 +14,8 @@
-
-
+
+
diff --git a/templates/topics.html b/templates/topics.html
index 81ec81f3..0ad02b68 100644
--- a/templates/topics.html
+++ b/templates/topics.html
@@ -59,13 +59,13 @@
-
+
{{range .ForumList}}{{end}}
diff --git a/templates/topics_quick_topic.html b/templates/topics_quick_topic.html
index 757f37fb..ba35e7d2 100644
--- a/templates/topics_quick_topic.html
+++ b/templates/topics_quick_topic.html
@@ -1,7 +1,7 @@
-
+
-
+
diff --git a/tickloop.go b/tickloop.go
index 40e987a4..b8205308 100644
--- a/tickloop.go
+++ b/tickloop.go
@@ -141,22 +141,34 @@ func tickLoop(thumbChan chan bool) {
}
}
-func dailies() {
+func asmMatches() {
// TODO: Find a more efficient way of doing this
- err := qgen.NewAcc().Select("activity_stream").Cols("asid").EachInt(func(asid int) error {
- count, err := qgen.NewAcc().Count("activity_stream_matches").Where("asid = " + strconv.Itoa(asid)).Total()
+ acc := qgen.NewAcc()
+ countStmt := acc.Count("activity_stream_matches").Where("asid=?").Prepare()
+ if err := acc.FirstError(); err != nil {
+ c.LogError(err)
+ return
+ }
+
+ err := acc.Select("activity_stream").Cols("asid").EachInt(func(asid int) error {
+ var count int
+ err := countStmt.QueryRow(asid).Scan(&count)
if err != sql.ErrNoRows {
return err
}
if count > 0 {
return nil
}
- _, err = qgen.NewAcc().Delete("activity_stream").Where("asid = ?").Run(asid)
+ _, err = qgen.NewAcc().Delete("activity_stream").Where("asid=?").Run(asid)
return err
})
if err != nil && err != sql.ErrNoRows {
c.LogError(err)
}
+}
+
+func dailies() {
+ asmMatches()
if c.Config.LogPruneCutoff > -1 {
f := func(tbl string) {
@@ -172,7 +184,7 @@ func dailies() {
if c.Config.PostIPCutoff > -1 {
// TODO: Use unixtime to remove this MySQLesque logic?
f := func(tbl string) {
- _, err := qgen.NewAcc().Update(tbl).Set("ipaddress = '0'").DateOlderThan("createdAt",c.Config.PostIPCutoff,"day").Where("ipaddress != '0'").Exec()
+ _, err := qgen.NewAcc().Update(tbl).Set("ipaddress='0'").DateOlderThan("createdAt",c.Config.PostIPCutoff,"day").Where("ipaddress!='0'").Exec()
if err != nil {
c.LogError(err)
}
@@ -182,16 +194,30 @@ func dailies() {
f("users_replies")
// TODO: Find some way of purging the ip data in polls_votes without breaking any anti-cheat measures which might be running... maybe hash it instead?
+ }
- // TODO: lastActiveAt isn't currently set, so we can't rely on this to purge last_ips of users who haven't been on in a while
- /*_, err = qgen.NewAcc().Update("users").Set("last_ip = '0'").DateOlderThan("lastActiveAt",c.Config.PostIPCutoff,"day").Where("last_ip != '0'").Exec()
+ // TODO: lastActiveAt isn't currently set, so we can't rely on this to purge last_ips of users who haven't been on in a while
+ /*if c.Config.LastIPCutoff == -1 {
+ _, err := qgen.NewAcc().Update("users").Set("last_ip=0").Where("last_ip!=0").Exec()
+ if err != nil {
+ c.LogError(err)
+ }
+ } else */if c.Config.LastIPCutoff > 0 {
+ /*_, err = qgen.NewAcc().Update("users").Set("last_ip='0'").DateOlderThan("lastActiveAt",c.Config.PostIPCutoff,"day").Where("last_ip!='0'").Exec()
if err != nil {
c.LogError(err)
}*/
+ mon := time.Now().Month()
+ _, err := qgen.NewAcc().Update("users").Set("last_ip=0").Where("last_ip!=0 AND last_ip NOT LIKE '"+strconv.Itoa(int(mon))+"-%'").Exec()
+ if err != nil {
+ c.LogError(err)
+ }
}
- err = c.Meta.Set("lastDaily", strconv.FormatInt(time.Now().Unix(), 10))
- if err != nil {
- c.LogError(err)
+ {
+ err := c.Meta.Set("lastDaily", strconv.FormatInt(time.Now().Unix(), 10))
+ if err != nil {
+ c.LogError(err)
+ }
}
}
\ No newline at end of file