Add DisablePollIP configuration setting.
This commit is contained in:
parent
0d81557009
commit
aed409ae9e
|
@ -234,8 +234,11 @@ func (s *DefaultPollStore) unpackOptionsMap(rawOptions map[int]string) []PollOpt
|
|||
}
|
||||
|
||||
// TODO: Use a transaction for this?
|
||||
func (s *DefaultPollStore) CastVote(optionIndex int, pollID int, uid int, ipaddress string) error {
|
||||
_, err := s.addVote.Exec(pollID, uid, optionIndex, ipaddress)
|
||||
func (s *DefaultPollStore) CastVote(optionIndex int, pollID int, uid int, ip string) error {
|
||||
if Config.DisablePollIP {
|
||||
ip = "0"
|
||||
}
|
||||
_, err := s.addVote.Exec(pollID, uid, optionIndex, ip)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ type config struct {
|
|||
LogPruneCutoff int
|
||||
|
||||
DisableLastIP bool
|
||||
DisablePollIP bool
|
||||
|
||||
DisableLiveTopicList bool
|
||||
DisableJSAntispam bool
|
||||
|
|
|
@ -88,10 +88,12 @@ LastIPCutoff - The number of months which need to pass before the last IP stored
|
|||
|
||||
PostIPCutoff - The number of days which need to pass before the IP data for a post is automatically deleted. 0 defaults to whatever the current default is, currently 120 and -1 disables this feature.
|
||||
|
||||
PollIPCutoff - The number of days which need to pass before the IP data for a poll is automatically deleted. 0 defaults to whatever the current default is, currently -1 and -1 disables this feature.
|
||||
PollIPCutoff - The number of days which need to pass before the IP data for a poll is automatically deleted. 0 defaults to whatever the current default is, currently 365 and -1 disables this feature.
|
||||
|
||||
DisableLastIP - Disable storing last IPs for users and purge any existing user last IP data. Default: false
|
||||
|
||||
DisablePollIP - Disable storing poll vote IPs and purge any existing poll vote IP data. Default: false
|
||||
|
||||
LogPruneCutoff - The number of days which need to pass before the login and registration logs are pruned. 0 defaults to whatever the current default is, currently 180 and -1 disables this feature.
|
||||
|
||||
DisableLiveTopicList - This switch allows you to disable the live topic list. Default: false
|
||||
|
|
|
@ -194,7 +194,12 @@ func dailies() {
|
|||
f("users_replies")
|
||||
}
|
||||
|
||||
if c.Config.PollIPCutoff > -1 {
|
||||
if c.Config.DisablePollIP {
|
||||
_, err := qgen.NewAcc().Update("polls_votes").Set("ipaddress='0'").Where("ipaddress!='0'").Exec()
|
||||
if err != nil {
|
||||
c.LogError(err)
|
||||
}
|
||||
} else if c.Config.PollIPCutoff > -1 {
|
||||
// TODO: Use unixtime to remove this MySQLesque logic?
|
||||
_, err := qgen.NewAcc().Update("polls_votes").Set("ipaddress='0'").DateOlderThan("castAt", c.Config.PollIPCutoff, "day").Where("ipaddress!='0'").Exec()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue