diff --git a/docs/content/administration/logging-config.en-us.md b/docs/content/administration/logging-config.en-us.md index d9739e1881ff..33470ca448ff 100644 --- a/docs/content/administration/logging-config.en-us.md +++ b/docs/content/administration/logging-config.en-us.md @@ -102,8 +102,11 @@ MODE = file, file-error ; by default, the "file" mode will record logs to %(log.ROOT_PATH)/gitea.log, so we don't need to set it ; [log.file] +; by default, the MODE (actually it's the output writer of this logger) is taken from the section name, so we don't need to set it either +; MODE = file [log.file-error] +MODE = file LEVEL = Error FILE_NAME = file-error.log ``` diff --git a/docs/content/installation/from-package.en-us.md b/docs/content/installation/from-package.en-us.md index 36f3e2db08fb..4c29c31efca2 100644 --- a/docs/content/installation/from-package.en-us.md +++ b/docs/content/installation/from-package.en-us.md @@ -40,7 +40,7 @@ apk add gitea ## Arch Linux -The rolling release distribution has [Gitea](https://www.archlinux.org/packages/community/x86_64/gitea/) in their official community repository and package updates are provided with new Gitea releases. +The rolling release distribution has [Gitea](https://www.archlinux.org/packages/extra/x86_64/gitea/) in their official extra repository and package updates are provided with new Gitea releases. ```sh pacman -S gitea diff --git a/models/git/branch.go b/models/git/branch.go index c68da1be7806..6d50fb9fb6a1 100644 --- a/models/git/branch.go +++ b/models/git/branch.go @@ -395,9 +395,9 @@ func FindRecentlyPushedNewBranches(ctx context.Context, repoID, userID int64, ex Where("pusher_id=? AND is_deleted=?", userID, false). And("name <> ?", excludeBranchName). And("repo_id = ?", repoID). - And("updated_unix >= ?", time.Now().Add(-time.Hour*6).Unix()). + And("commit_time >= ?", time.Now().Add(-time.Hour*6).Unix()). NotIn("name", subQuery). - OrderBy("branch.updated_unix DESC"). + OrderBy("branch.commit_time DESC"). Limit(2). Find(&branches) return branches, err diff --git a/models/repo/pushmirror.go b/models/repo/pushmirror.go index f34484f63878..dad9a9d38851 100644 --- a/models/repo/pushmirror.go +++ b/models/repo/pushmirror.go @@ -85,6 +85,12 @@ func UpdatePushMirror(ctx context.Context, m *PushMirror) error { return err } +// UpdatePushMirrorInterval updates the push-mirror +func UpdatePushMirrorInterval(ctx context.Context, m *PushMirror) error { + _, err := db.GetEngine(ctx).ID(m.ID).Cols("interval").Update(m) + return err +} + func DeletePushMirrors(ctx context.Context, opts PushMirrorOptions) error { if opts.RepoID > 0 { _, err := db.GetEngine(ctx).Where(opts.toConds()).Delete(&PushMirror{}) diff --git a/modules/setting/log.go b/modules/setting/log.go index 66206f8f4b22..e404074b72f0 100644 --- a/modules/setting/log.go +++ b/modules/setting/log.go @@ -165,7 +165,7 @@ func loadLogModeByName(rootCfg ConfigProvider, loggerName, modeName string) (wri writerMode.WriterOption = writerOption default: if !log.HasEventWriter(writerType) { - return "", "", writerMode, fmt.Errorf("invalid log writer type (mode): %s", writerType) + return "", "", writerMode, fmt.Errorf("invalid log writer type (mode): %s, maybe it needs something like 'MODE=file' in [log.%s] section", writerType, modeName) } } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 3256d2ba911c..6cb830b6d02c 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1966,6 +1966,8 @@ settings.mirror_settings.last_update = Last update settings.mirror_settings.push_mirror.none = No push mirrors configured settings.mirror_settings.push_mirror.remote_url = Git Remote Repository URL settings.mirror_settings.push_mirror.add = Add Push Mirror +settings.mirror_settings.push_mirror.edit_sync_time = Edit mirror sync interval + settings.sync_mirror = Synchronize Now settings.mirror_sync_in_progress = Mirror synchronization is in progress. Check back in a minute. settings.site = Website diff --git a/routers/web/repo/setting/setting.go b/routers/web/repo/setting/setting.go index b33660ffc9cc..71c1939f2990 100644 --- a/routers/web/repo/setting/setting.go +++ b/routers/web/repo/setting/setting.go @@ -299,6 +299,43 @@ func SettingsPost(ctx *context.Context) { ctx.Flash.Info(ctx.Tr("repo.settings.mirror_sync_in_progress")) ctx.Redirect(repo.Link() + "/settings") + case "push-mirror-update": + if !setting.Mirror.Enabled { + ctx.NotFound("", nil) + return + } + + // This section doesn't require repo_name/RepoName to be set in the form, don't show it + // as an error on the UI for this action + ctx.Data["Err_RepoName"] = nil + + interval, err := time.ParseDuration(form.PushMirrorInterval) + if err != nil || (interval != 0 && interval < setting.Mirror.MinInterval) { + ctx.RenderWithErr(ctx.Tr("repo.mirror_interval_invalid"), tplSettingsOptions, &forms.RepoSettingForm{}) + return + } + + id, err := strconv.ParseInt(form.PushMirrorID, 10, 64) + if err != nil { + ctx.ServerError("UpdatePushMirrorIntervalPushMirrorID", err) + return + } + m := &repo_model.PushMirror{ + ID: id, + Interval: interval, + } + if err := repo_model.UpdatePushMirrorInterval(ctx, m); err != nil { + ctx.ServerError("UpdatePushMirrorInterval", err) + return + } + // Background why we are adding it to Queue + // If we observed its implementation in the context of `push-mirror-sync` where it + // is evident that pushing to the queue is necessary for updates. + // So, there are updates within the given interval, it is necessary to update the queue accordingly. + mirror_module.AddPushMirrorToQueue(m.ID) + ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) + ctx.Redirect(repo.Link() + "/settings") + case "push-mirror-remove": if !setting.Mirror.Enabled { ctx.NotFound("", nil) diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 9e6b3e782576..15c85f6427ce 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -999,10 +999,18 @@ func renderCode(ctx *context.Context) { ctx.ServerError("GetBaseRepo", err) return } - ctx.Data["RecentlyPushedNewBranches"], err = git_model.FindRecentlyPushedNewBranches(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID, ctx.Repo.Repository.DefaultBranch) - if err != nil { - ctx.ServerError("GetRecentlyPushedBranches", err) - return + + showRecentlyPushedNewBranches := true + if ctx.Repo.Repository.IsMirror || + !ctx.Repo.Repository.UnitEnabled(ctx, unit_model.TypePullRequests) { + showRecentlyPushedNewBranches = false + } + if showRecentlyPushedNewBranches { + ctx.Data["RecentlyPushedNewBranches"], err = git_model.FindRecentlyPushedNewBranches(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID, ctx.Repo.Repository.DefaultBranch) + if err != nil { + ctx.ServerError("GetRecentlyPushedBranches", err) + return + } } } diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl index fc8bf6081100..e59e279c0030 100644 --- a/templates/projects/list.tmpl +++ b/templates/projects/list.tmpl @@ -1,4 +1,4 @@ -{{if .CanWriteProjects}} +{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
@@ -72,7 +72,7 @@ {{template "base/paginate" .}} -{{if $.CanWriteProjects}} +{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}