summaryrefslogtreecommitdiffstats
path: root/routers/repo/setting.go
diff options
context:
space:
mode:
authorJonas Bröms <9416498+cez81@users.noreply.github.com>2018-11-09 00:58:02 +0100
committertechknowlogick <hello@techknowlogick.com>2018-11-08 18:58:02 -0500
commit599adde1bc3670279d371fd9f2620c2829286bf6 (patch)
treea7d2dce94f1328a9c504478d9a2a8b49265a0811 /routers/repo/setting.go
parentde8f98192b113fde31c6361584b624c48de83895 (diff)
downloadgitea-599adde1bc3670279d371fd9f2620c2829286bf6.tar.gz
gitea-599adde1bc3670279d371fd9f2620c2829286bf6.zip
Add option to disable automatic mirror syncing. (#5242)
Setting the interval to 0 will disable to automatic syncing.
Diffstat (limited to 'routers/repo/setting.go')
-rw-r--r--routers/repo/setting.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index ff6b07f8e0..61b00d793b 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -117,12 +117,16 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
}
interval, err := time.ParseDuration(form.Interval)
- if err != nil || interval < setting.Mirror.MinInterval {
+ if err != nil && (interval != 0 || interval < setting.Mirror.MinInterval) {
ctx.RenderWithErr(ctx.Tr("repo.mirror_interval_invalid"), tplSettingsOptions, &form)
} else {
ctx.Repo.Mirror.EnablePrune = form.EnablePrune
ctx.Repo.Mirror.Interval = interval
- ctx.Repo.Mirror.NextUpdateUnix = util.TimeStampNow().AddDuration(interval)
+ if interval != 0 {
+ ctx.Repo.Mirror.NextUpdateUnix = util.TimeStampNow().AddDuration(interval)
+ } else {
+ ctx.Repo.Mirror.NextUpdateUnix = 0
+ }
if err := models.UpdateMirror(ctx.Repo.Mirror); err != nil {
ctx.RenderWithErr(ctx.Tr("repo.mirror_interval_invalid"), tplSettingsOptions, &form)
return