Skip to content

Commit 14d96ff

Browse files
Disable unnecessary mirroring elements (#18527)
* Disable unnecessary mirroring elements This mod fixes disabling unnecessary mirroring elements. Related: #16957 Related: #13084 Author-Change-Id: IB#1105104 * Checkbox rendering disabled instead of hiding it Fixes: 02b4505 Related: #18527 (review) Author-Change-Id: IB#1105104 * Update custom/conf/app.example.ini Co-authored-by: silverwind <[email protected]> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: silverwind <[email protected]> * Mirror filter removed only when whole mirroring feature is disabled Fixes: 02b4505 Related: #18527 (comment) Author-Change-Id: IB#1105104 Co-authored-by: silverwind <[email protected]>
1 parent 867b34d commit 14d96ff

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2091,7 +2091,7 @@ PATH =
20912091
;[mirror]
20922092
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20932093
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2094-
;; Enables the mirror functionality. Set to **false** to disable all mirrors.
2094+
;; Enables the mirror functionality. Set to **false** to disable all mirrors. Pre-existing mirrors remain valid but won't be updated; may be converted to regular repo.
20952095
;ENABLED = true
20962096
;; Disable the creation of **new** pull mirrors. Pre-existing mirrors remain valid. Will be ignored if `mirror.ENABLED` is `false`.
20972097
;DISABLE_NEW_PULL = false

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
10951095

10961096
## Mirror (`mirror`)
10971097

1098-
- `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors.
1098+
- `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors. Pre-existing mirrors remain valid but won't be updated; may be converted to regular repo.
10991099
- `DISABLE_NEW_PULL`: **false**: Disable the creation of **new** pull mirrors. Pre-existing mirrors remain valid. Will be ignored if `mirror.ENABLED` is `false`.
11001100
- `DISABLE_NEW_PUSH`: **false**: Disable the creation of **new** push mirrors. Pre-existing mirrors remain valid. Will be ignored if `mirror.ENABLED` is `false`.
11011101
- `DEFAULT_INTERVAL`: **8h**: Default interval between each check

options/locale/locale_en-US.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ need_auth = Authorization
930930
migrate_options = Migration Options
931931
migrate_service = Migration Service
932932
migrate_options_mirror_helper = This repository will be a <span class="text blue">mirror</span>
933-
migrate_options_mirror_disabled = Your site administrator has disabled new mirrors.
934933
migrate_options_lfs = Migrate LFS files
935934
migrate_options_lfs_endpoint.label = LFS Endpoint
936935
migrate_options_lfs_endpoint.description = Migration will attempt to use your Git remote to <a target="_blank" rel="noopener noreferrer" href="%s">determine the LFS server</a>. You can also specify a custom endpoint if the repository LFS data is stored somewhere else.

routers/web/user/home.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ func Dashboard(ctx *context.Context) {
7878
ctx.Data["PageIsNews"] = true
7979
cnt, _ := organization.GetOrganizationCount(ctx, ctxUser)
8080
ctx.Data["UserOrgsCount"] = cnt
81+
ctx.Data["MirrorsEnabled"] = setting.Mirror.Enabled
8182

8283
var uid int64
8384
if ctxUser != nil {

services/cron/tasks_basic.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ func registerCleanupPackages() {
155155
}
156156

157157
func initBasicTasks() {
158-
registerUpdateMirrorTask()
158+
if setting.Mirror.Enabled {
159+
registerUpdateMirrorTask()
160+
}
159161
registerRepoHealthCheck()
160162
registerCheckRepoStats()
161163
registerArchiveCleanup()

templates/repo/migrate/options.tmpl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
{{if not .DisableNewPullMirrors}}
12
<div class="inline field">
23
<label>{{.i18n.Tr "repo.migrate_options"}}</label>
34
<div class="ui checkbox">
4-
{{if .DisableNewPullMirrors}}
5-
<input id="mirror" name="mirror" type="checkbox" readonly>
6-
<label>{{.i18n.Tr "repo.migrate_options_mirror_disabled"}}</label>
7-
{{else}}
8-
<input id="mirror" name="mirror" type="checkbox" {{if .mirror}} checked{{end}}>
9-
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
10-
{{end}}
5+
<input id="mirror" name="mirror" type="checkbox" {{if .mirror}} checked{{end}}>
6+
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
117
</div>
128
</div>
9+
{{end}}
1310
{{if .LFSActive}}
1411
<div class="inline field">
1512
<label></label>

templates/user/dashboard/repolist.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@
109109
{{.i18n.Tr "forks"}}
110110
<div v-show="reposFilter === 'forks'" class="ui circular mini grey label">${repoTypeCount}</div>
111111
</a>
112+
{{if .MirrorsEnabled}}
112113
<a class="item" :class="{active: reposFilter === 'mirrors'}" @click="changeReposFilter('mirrors')">
113114
{{.i18n.Tr "mirrors"}}
114115
<div v-show="reposFilter === 'mirrors'" class="ui circular mini grey label">${repoTypeCount}</div>
115116
</a>
117+
{{end}}
116118
<a class="item" :class="{active: reposFilter === 'collaborative'}" @click="changeReposFilter('collaborative')">
117119
{{.i18n.Tr "collaborative"}}
118120
<div v-show="reposFilter === 'collaborative'" class="ui circular mini grey label">${repoTypeCount}</div>

0 commit comments

Comments
 (0)