1
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-05-01 13:15:20 +00:00
gitea/modules/util
Lunny Xiao 32b97b3ce8
Uniform all temporary directories and allow customizing temp path ()
This PR uniform all temporary directory usage so that it will be easier
to manage.

Relate to  

- [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 () 2025-04-08 16:15:28 +00:00
rotatingfilewriter Replace interface{} with any () 2023-07-04 18:36:08 +00:00
color_test.go Enable tenv and testifylint rules () 2024-12-15 10:41:29 +00:00
color.go Fix project column title overflow () 2024-05-20 05:21:01 +00:00
error.go Refactor error system () 2025-03-03 05:36:10 +00:00
file_unix_test.go Implement FSFE REUSE for golang files () 2022-11-27 18:20:29 +00:00
file_unix.go Implement FSFE REUSE for golang files () 2022-11-27 18:20:29 +00:00
file_windows.go Implement FSFE REUSE for golang files () 2022-11-27 18:20:29 +00:00
io_test.go Fix profile render when the README.md size is larger than 1024 bytes () 2023-06-13 09:02:25 +00:00
io.go Refactor markup package () 2024-11-04 10:59:50 +00:00
keypair_test.go Enable tenv and testifylint rules () 2024-12-15 10:41:29 +00:00
keypair.go Enable unparam linter () 2024-06-11 18:47:45 +00:00
legacy_test.go Upgrade golangci-lint to v1.64.5 () 2025-02-21 00:05:40 +08:00
legacy.go Implement FSFE REUSE for golang files () 2022-11-27 18:20:29 +00:00
pack_test.go Add support for incoming emails () 2023-01-14 23:57:10 +08:00
pack.go Replace interface{} with any () 2023-07-04 18:36:08 +00:00
paginate_test.go Enable testifylint rules () 2025-03-31 01:53:48 -04:00
paginate.go Replace interface{} with any () 2023-07-04 18:36:08 +00:00
path_test.go Fix unittest and repo create bug () 2024-12-31 18:45:05 +08:00
path.go enable staticcheck QFxxxx rules () 2025-03-29 17:32:28 -04:00
remove.go Implement FSFE REUSE for golang files () 2022-11-27 18:20:29 +00:00
runtime_test.go Use test context in tests and new loop system in benchmarks () 2025-02-20 09:57:40 +00:00
runtime.go Refactor pprof labels and process desc () 2024-12-20 12:17:14 +08:00
sanitize_test.go Implement FSFE REUSE for golang files () 2022-11-27 18:20:29 +00:00
sanitize.go Refactor to use UnsafeStringToBytes () 2024-06-14 01:26:33 +00:00
sec_to_time_test.go Enable testifylint rules () 2025-03-31 01:53:48 -04:00
sec_to_time.go Worktime tracking for the organization level () 2025-02-03 01:51:12 +08:00
shellquote_test.go Refactor older tests to use testify () 2025-01-09 09:21:47 +08:00
shellquote.go Implement FSFE REUSE for golang files () 2022-11-27 18:20:29 +00:00
slice_test.go Replace util.SliceXxx with slices.Xxx () 2023-09-07 09:37:47 +00:00
slice.go Fix various problems (artifact order, api empty slice, assignee check, fuzzy prompt, mirror proxy, adopt git) () 2025-02-13 03:26:27 +08:00
string_test.go Do not render truncated links in markdown () 2024-12-26 00:33:55 +08:00
string.go Do not render truncated links in markdown () 2024-12-26 00:33:55 +08:00
time_str_test.go Enable tenv and testifylint rules () 2024-12-15 10:41:29 +00:00
time_str.go Update go tool dependencies () 2024-12-19 19:17:55 +01:00
timer_test.go Use a general approach to access custom/static/builtin assets () 2023-04-12 18:16:45 +08:00
timer.go Rewrite queue () 2023-05-08 19:49:59 +08:00
truncate_test.go Enable addtional linters () 2025-04-01 10:14:01 +00:00
truncate.go Improve "ellipsis string" () 2024-12-26 14:19:35 +08:00
url.go Add RemoteAddress to mirrors () 2023-09-16 16:03:02 +00:00
util_test.go Move ParseBool to optional () 2025-03-24 03:53:30 +00:00
util.go Fix markdown render behaviors () 2025-04-05 11:56:48 +08:00