generate-fixtures: write byte-identical assets once in the default assets/ output
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #470 của @silverbackdan — đã merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start with StoredFileExporter, which writes the assets/ files that generate-fixtures emits, and check how it names files today. Read UploadableFileManager::persistFiles() to confirm it only reads the source through a stream. Run GenerateFixturesCommandTest and generate_fixtures_round_trip.feature to see the current output. Done means identical content is written once under a sha256-keyed name, name clashes with different content still get -2, -3, and the round trip regenerates byte for byte.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
generate-fixtures writes one file under assets/ per uploadable field, even when the stored files are byte-identical. On bcio (2.0.0-alpha.22), 76 exported assets (4.8 MB) hold only 20 distinct contents (1.0 MB). One SVG is written 20 times, as phppopacd.svg, phppopacd-2.svg and so on. The stored files really are separate uploads of the same image.
The content-hash store from #462 / #466 already writes each distinct content once, but it is opt-in. The default assets/ output should do the same:
StoredFileExporterkeys what it has written by the content's sha256. Content it has already written returns the existing name, so everynew File(__DIR__ . '/assets/…')for that content points at one file.- A name clash with different content still gets
-2,-3… - The first file in site-map order names the shared asset, so a reload stores the later resources under that slug. Regenerating after the reload gives the same file, so it is still a fixed point.
- Sharing is safe on load:
UploadableFileManager::persistFiles()reads the source through a stream and never moves it.
Proposed tests:
GenerateFixturesCommandTest: two resources with identical bytes under different stored names give one asset and twonew File()lines naming it. Different bytes under one name still give-2.- Round trip (
generate_fixtures_round_trip.feature): a site with two identical uploads reloads with both files present and regenerates byte for byte.
Reported by the bcio session. This would save 79% of bcio's assets, and probably a good share of Cymru Kitchens' 275 MB.
- Ngôn ngữ chính
- PHP
- Star
- 32
- Fork
- 8
- Merge trung bình
- 1 giờ
- Pull request đã merge (30 ngày)
- 186
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của components-web-app/api-components-bundle
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
components-web-app/api-components-bundle#333 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
components-web-app/api-components-bundle#325 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
components-web-app/api-components-bundle#259 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
components-web-app/api-components-bundle#186 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của components-web-app/api-components-bundle
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
grokability/snipe-it#19869 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Перевод устарел
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100