Skip to content
Snippets Groups Projects
Commit 994666c0 authored by Howl's avatar Howl
Browse files

Add DeleteOldPrivateTokens

parent 5f93ac3d
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ type config struct { ...@@ -35,6 +35,7 @@ type config struct {
RemoveDonorOnExpired bool RemoveDonorOnExpired bool
FixMultipleCompletedScores bool `description:"Set completed=2 if multiple completed=3 scores for same beatmap and user are present."` FixMultipleCompletedScores bool `description:"Set completed=2 if multiple completed=3 scores for same beatmap and user are present."`
ClearExpiredProfileBackgrounds bool ClearExpiredProfileBackgrounds bool
DeleteOldPrivateTokens bool `description:"Whether to delete old private (private = 1) API tokens (older than a month)"`
Workers int `description:"The number of goroutines which should execute queries. Increasing it may make cron faster, depending on your system."` Workers int `description:"The number of goroutines which should execute queries. Increasing it may make cron faster, depending on your system."`
} }
...@@ -128,6 +129,11 @@ func main() { ...@@ -128,6 +129,11 @@ func main() {
beatmaps.ranked != '4';`) beatmaps.ranked != '4';`)
color.Green(" ok!") color.Green(" ok!")
} }
if c.DeleteOldPrivateTokens {
fmt.Println("Starting deleting old private API tokens")
go op(`DELETE FROM tokens WHERE private = 1 AND last_updated < ?`, time.Now().Add(-time.Hour*24*30))
color.Green(" ok!")
}
if c.UnrankScoresOnInvalidBeatmaps { if c.UnrankScoresOnInvalidBeatmaps {
fmt.Print("Unranking scores on invalid beatmaps...") fmt.Print("Unranking scores on invalid beatmaps...")
go op(`DELETE scores.* FROM scores go op(`DELETE scores.* FROM scores
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment