Commit 994666c0 authored by Howl's avatar Howl
Browse files

Add DeleteOldPrivateTokens

parent 5f93ac3d
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -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() {
				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