Skip to content

Commit 02b4505

Browse files
committed
Disable unnecessary mirroring elements
This mod fixes disabling unnecessary mirroring elements. Related: #16957 Related: #13084 Author-Change-Id: IB#1105104
1 parent b7c6457 commit 02b4505

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,7 @@ PATH =
19961996
;[mirror]
19971997
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19981998
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1999-
;; Enables the mirror functionality. Set to **false** to disable all mirrors.
1999+
;; 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).
20002000
;ENABLED = true
20012001
;; Disable the creation of **new** pull mirrors. Pre-existing mirrors remain valid. Will be ignored if `mirror.ENABLED` is `false`.
20022002
;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
@@ -1061,7 +1061,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
10611061

10621062
## Mirror (`mirror`)
10631063

1064-
- `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors.
1064+
- `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).
10651065
- `DISABLE_NEW_PULL`: **false**: Disable the creation of **new** pull mirrors. Pre-existing mirrors remain valid. Will be ignored if `mirror.ENABLED` is `false`.
10661066
- `DISABLE_NEW_PUSH`: **false**: Disable the creation of **new** push mirrors. Pre-existing mirrors remain valid. Will be ignored if `mirror.ENABLED` is `false`.
10671067
- `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
@@ -908,7 +908,6 @@ need_auth = Authorization
908908
migrate_options = Migration Options
909909
migrate_service = Migration Service
910910
migrate_options_mirror_helper = This repository will be a <span class="text blue">mirror</span>
911-
migrate_options_mirror_disabled = Your site administrator has disabled new mirrors.
912911
migrate_options_lfs = Migrate LFS files
913912
migrate_options_lfs_endpoint.label = LFS Endpoint
914913
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
@@ -77,6 +77,7 @@ func Dashboard(ctx *context.Context) {
7777
ctx.Data["PageIsNews"] = true
7878
cnt, _ := models.GetOrganizationCount(db.DefaultContext, ctxUser)
7979
ctx.Data["UserOrgsCount"] = cnt
80+
ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull
8081

8182
var uid int64
8283
if ctxUser != nil {

services/cron/tasks_basic.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ func registerCleanupHookTaskTable() {
141141
}
142142

143143
func initBasicTasks() {
144-
registerUpdateMirrorTask()
144+
if setting.Mirror.Enabled {
145+
registerUpdateMirrorTask()
146+
}
145147
registerRepoHealthCheck()
146148
registerCheckRepoStats()
147149
registerArchiveCleanup()

templates/repo/migrate/options.tmpl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
<div class="inline field">
1+
<div class="inline field" {{if .DisableNewPullMirrors}} hidden{{end}}>
22
<label>{{.i18n.Tr "repo.migrate_options"}}</label>
33
<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}}
4+
<input id="mirror" name="mirror" type="checkbox" {{if and .mirror (not .DisableNewPullMirrors)}} checked{{end}}>
5+
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
116
</div>
127
</div>
138
{{if .LFSActive}}

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 not .DisableNewPullMirrors}}
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)