|
|
@ -9,6 +9,7 @@ import ( |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/admin" |
|
|
|
asymkey_model "code.gitea.io/gitea/models/asymkey" |
|
|
|
asymkey_model "code.gitea.io/gitea/models/asymkey" |
|
|
|
user_model "code.gitea.io/gitea/models/user" |
|
|
|
user_model "code.gitea.io/gitea/models/user" |
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
"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() { |
|
|
|
func initExtendedTasks() { |
|
|
|
registerDeleteInactiveUsers() |
|
|
|
registerDeleteInactiveUsers() |
|
|
|
registerDeleteRepositoryArchives() |
|
|
|
registerDeleteRepositoryArchives() |
|
|
@ -166,4 +181,5 @@ func initExtendedTasks() { |
|
|
|
registerRemoveRandomAvatars() |
|
|
|
registerRemoveRandomAvatars() |
|
|
|
registerDeleteOldActions() |
|
|
|
registerDeleteOldActions() |
|
|
|
registerUpdateGiteaChecker() |
|
|
|
registerUpdateGiteaChecker() |
|
|
|
|
|
|
|
registerDeleteOldSystemNotices() |
|
|
|
} |
|
|
|
} |
|
|
|