gitea/modules/util
Lunny Xiao 32b97b3ce8
Uniform all temporary directories and allow customizing temp path (#32352)
This PR uniform all temporary directory usage so that it will be easier
to manage.

Relate to #31792 

- [x] Added a new setting to allow users to configure the global
temporary directory.
- [x] Move all temporary files and directories to be placed under
os.Temp()/gitea.
- [x] `setting.Repository.Local.LocalCopyPath` now will be
`setting.TempPath/local-repo` and the customized path is removed.
```diff
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;[repository.local]
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Path for local repository copy. Defaults to  TEMP_PATH + `local-repo`, this is deprecated and cannot be changed
-;LOCAL_COPY_PATH = local-repo
```

- [x] `setting.Repository.Upload.TempPath` now will be
`settting.TempPath/uploads` and the customized path is removed.
```diff
;[repository.upload]
-;;
-;; Path for uploads. Defaults to TEMP_PATH + `uploads`
-;TEMP_PATH = uploads
```

- [x] `setting.Packages.ChunkedUploadPath` now will be
`settting.TempPath/package-upload` and the customized path is removed.
```diff
;[packages]
-;;
-;; Path for chunked uploads. Defaults it's `package-upload` under `TEMP_PATH` unless it's an absolute path.
-;CHUNKED_UPLOAD_PATH = package-upload
```

- [x] `setting.SSH.KeyTestPath` now will be
`settting.TempPath/ssh_key_test` and the customized path is removed.
```diff
[server]
-;;
-;; Directory to create temporary files in when testing public keys using ssh-keygen,
-;; default is the system temporary directory.
-;SSH_KEY_TEST_PATH =
```

TODO:
- [ ] setting.PprofDataPath haven't been changed because it may need to
be kept until somebody read it but temp path may be clean up any time.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-08 16:15:28 +00:00
..
filebuffer Uniform all temporary directories and allow customizing temp path (#32352) 2025-04-08 16:15:28 +00:00
rotatingfilewriter
color_test.go Enable tenv and testifylint rules (#32852) 2024-12-15 10:41:29 +00:00
color.go Fix project column title overflow (#31011) 2024-05-20 05:21:01 +00:00
error.go Refactor error system (#33771) 2025-03-03 05:36:10 +00:00
file_unix_test.go
file_unix.go
file_windows.go
io_test.go
io.go Refactor markup package (#32399) 2024-11-04 10:59:50 +00:00
keypair_test.go Enable tenv and testifylint rules (#32852) 2024-12-15 10:41:29 +00:00
keypair.go Enable unparam linter (#31277) 2024-06-11 18:47:45 +00:00
legacy_test.go Upgrade golangci-lint to v1.64.5 (#33654) 2025-02-21 00:05:40 +08:00
legacy.go
pack_test.go
pack.go
paginate_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
paginate.go
path_test.go Fix unittest and repo create bug (#33061) 2024-12-31 18:45:05 +08:00
path.go enable staticcheck QFxxxx rules (#34064) 2025-03-29 17:32:28 -04:00
remove.go
runtime_test.go Use test context in tests and new loop system in benchmarks (#33648) 2025-02-20 09:57:40 +00:00
runtime.go Refactor pprof labels and process desc (#32909) 2024-12-20 12:17:14 +08:00
sanitize_test.go
sanitize.go Refactor to use UnsafeStringToBytes (#31358) 2024-06-14 01:26:33 +00:00
sec_to_time_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
sec_to_time.go Worktime tracking for the organization level (#19808) 2025-02-03 01:51:12 +08:00
shellquote_test.go Refactor older tests to use testify (#33140) 2025-01-09 09:21:47 +08:00
shellquote.go
slice_test.go
slice.go Fix various problems (artifact order, api empty slice, assignee check, fuzzy prompt, mirror proxy, adopt git) (#33569) 2025-02-13 03:26:27 +08:00
string_test.go Do not render truncated links in markdown (#32980) 2024-12-26 00:33:55 +08:00
string.go Do not render truncated links in markdown (#32980) 2024-12-26 00:33:55 +08:00
time_str_test.go Enable tenv and testifylint rules (#32852) 2024-12-15 10:41:29 +00:00
time_str.go Update go tool dependencies (#32916) 2024-12-19 19:17:55 +01:00
timer_test.go
timer.go
truncate_test.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
truncate.go Improve "ellipsis string" (#32989) 2024-12-26 14:19:35 +08:00
url.go
util_test.go Move ParseBool to optional (#33979) 2025-03-24 03:53:30 +00:00
util.go Fix markdown render behaviors (#34122) 2025-04-05 11:56:48 +08:00