diff options
author | Zettat123 <zettat123@gmail.com> | 2023-03-23 20:30:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 20:30:28 +0800 |
commit | df411819ebe4d3e6852997ce41fadf837d5d4ea0 (patch) | |
tree | 453eec26760e73e16db2c6f7564a59f77b5d9154 /modules | |
parent | 9be90a58754061171bbd5025d85d2b891364efd3 (diff) | |
download | gitea-df411819ebe4d3e6852997ce41fadf837d5d4ea0.tar.gz gitea-df411819ebe4d3e6852997ce41fadf837d5d4ea0.zip |
Check LFS/Packages settings in dump and doctor command (#23631)
Close #23622
As described in the issue, disabling the LFS/Package settings will cause
errors when running `gitea dump` or `gitea doctor`. We need to check the
settings and the related operations should be skipped if the settings
are disabled.
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/doctor/storage.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/doctor/storage.go b/modules/doctor/storage.go index c20566d675..f338537864 100644 --- a/modules/doctor/storage.go +++ b/modules/doctor/storage.go @@ -16,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/log" packages_module "code.gitea.io/gitea/modules/packages" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/storage" "code.gitea.io/gitea/modules/util" ) @@ -111,6 +112,10 @@ func checkStorage(opts *checkStorageOptions) func(ctx context.Context, logger lo } if opts.LFS || opts.All { + if !setting.LFS.StartServer { + logger.Info("LFS isn't enabled (skipped)") + return nil + } if err := commonCheckStorage(ctx, logger, autofix, &commonStorageCheckOptions{ storer: storage.LFS, @@ -173,6 +178,10 @@ func checkStorage(opts *checkStorageOptions) func(ctx context.Context, logger lo } if opts.Packages || opts.All { + if !setting.Packages.Enabled { + logger.Info("Packages isn't enabled (skipped)") + return nil + } if err := commonCheckStorage(ctx, logger, autofix, &commonStorageCheckOptions{ storer: storage.Packages, |