diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index b3b9fd96cc708..2643747dd6859 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -60,7 +60,7 @@ DISABLED_REPO_UNITS = DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects ; Prefix archive files by placing them in a directory named after the repository PREFIX_ARCHIVE_FILES = true -; Disable the creation of new mirrors. Pre-existing mirrors remain valid. +; Disable mirroring feature. Pre-existing mirrors remain valid but cannot be updated (may be converted to regular repo). DISABLE_MIRRORS = false ; The default branch name of new repositories DEFAULT_BRANCH=master diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 673eeac79ddae..4de5caf9ac093 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -70,7 +70,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `ENABLE_PUSH_CREATE_USER`: **false**: Allow users to push local repositories to Gitea and have them automatically created for a user. - `ENABLE_PUSH_CREATE_ORG`: **false**: Allow users to push local repositories to Gitea and have them automatically created for an org. - `PREFIX_ARCHIVE_FILES`: **true**: Prefix archive files by placing them in a directory named after the repository. -- `DISABLE_MIRRORS`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid. +- `DISABLE_MIRRORS`: **false**: Disable mirroring feature. Pre-existing mirrors remain valid but cannot be updated (may be converted to regular repo). - `DEFAULT_BRANCH`: **master**: Default branch name of all repositories. ### Repository - Pull Request (`repository.pull-request`) diff --git a/modules/cron/tasks_basic.go b/modules/cron/tasks_basic.go index 4da21fc7d9ddd..09f7979f45638 100644 --- a/modules/cron/tasks_basic.go +++ b/modules/cron/tasks_basic.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/migrations" repository_service "code.gitea.io/gitea/modules/repository" + "code.gitea.io/gitea/modules/setting" mirror_service "code.gitea.io/gitea/services/mirror" ) @@ -109,7 +110,9 @@ func registerUpdateMigrationPosterID() { } func initBasicTasks() { - registerUpdateMirrorTask() + if !setting.Repository.DisableMirrors { + registerUpdateMirrorTask() + } registerRepoHealthCheck() registerCheckRepoStats() registerArchiveCleanup() diff --git a/routers/user/home.go b/routers/user/home.go index f7f1786b3302b..4f111a334dc38 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -110,6 +110,7 @@ func Dashboard(ctx *context.Context) { ctx.Data["Title"] = ctxUser.DisplayName() + " - " + ctx.Tr("dashboard") ctx.Data["PageIsDashboard"] = true + ctx.Data["DisableMirrors"] = setting.Repository.DisableMirrors ctx.Data["PageIsNews"] = true ctx.Data["SearchLimit"] = setting.UI.User.RepoPagingNum // no heatmap access for admins; GetUserHeatmapDataByUser ignores the calling user diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl index 34a1c7bd0d1e3..7d5a90ecd1c48 100644 --- a/templates/repo/migrate/git.tmpl +++ b/templates/repo/migrate/git.tmpl @@ -28,16 +28,11 @@ -
+
- {{if .DisableMirrors}} - - - {{else}} - - - {{end}} + +
diff --git a/templates/repo/migrate/github.tmpl b/templates/repo/migrate/github.tmpl index 4d382ebbb5cd4..d449f43f09943 100644 --- a/templates/repo/migrate/github.tmpl +++ b/templates/repo/migrate/github.tmpl @@ -25,16 +25,11 @@ {{svg "octicon-question"}}
-
+
- {{if .DisableMirrors}} - - - {{else}} - - - {{end}} + +
diff --git a/templates/repo/migrate/gitlab.tmpl b/templates/repo/migrate/gitlab.tmpl index edf742eb990be..6ee8dc1652e3c 100644 --- a/templates/repo/migrate/gitlab.tmpl +++ b/templates/repo/migrate/gitlab.tmpl @@ -25,16 +25,11 @@ {{svg "octicon-question"}}
-
+
- {{if .DisableMirrors}} - - - {{else}} - - - {{end}} + +
diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl index 717318634e69b..17d2681a36361 100644 --- a/templates/user/dashboard/repolist.tmpl +++ b/templates/user/dashboard/repolist.tmpl @@ -81,10 +81,12 @@ {{.i18n.Tr "forks"}}
${repoTypeCount}
- - {{.i18n.Tr "mirrors"}} -
${repoTypeCount}
-
+ {{if not .DisableMirrors}} + + {{.i18n.Tr "mirrors"}} +
${repoTypeCount}
+
+ {{end}} {{.i18n.Tr "collaborative"}}
${repoTypeCount}