|
|
|
@ -9,6 +9,7 @@ import ( |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
|
"code.gitea.io/gitea/models/admin" |
|
|
|
|
asymkey_model "code.gitea.io/gitea/models/asymkey" |
|
|
|
|
user_model "code.gitea.io/gitea/models/user" |
|
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
@ -154,6 +155,20 @@ func registerUpdateGiteaChecker() { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func registerDeleteOldSystemNotices() { |
|
|
|
|
RegisterTaskFatal("delete_old_system_notices", &OlderThanConfig{ |
|
|
|
|
BaseConfig: BaseConfig{ |
|
|
|
|
Enabled: false, |
|
|
|
|
RunAtStart: false, |
|
|
|
|
Schedule: "@every 168h", |
|
|
|
|
}, |
|
|
|
|
OlderThan: 365 * 24 * time.Hour, |
|
|
|
|
}, func(ctx context.Context, _ *user_model.User, config Config) error { |
|
|
|
|
olderThanConfig := config.(*OlderThanConfig) |
|
|
|
|
return admin.DeleteOldSystemNotices(olderThanConfig.OlderThan) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func initExtendedTasks() { |
|
|
|
|
registerDeleteInactiveUsers() |
|
|
|
|
registerDeleteRepositoryArchives() |
|
|
|
@ -166,4 +181,5 @@ func initExtendedTasks() { |
|
|
|
|
registerRemoveRandomAvatars() |
|
|
|
|
registerDeleteOldActions() |
|
|
|
|
registerUpdateGiteaChecker() |
|
|
|
|
registerDeleteOldSystemNotices() |
|
|
|
|
} |
|
|
|
|