Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

generate-fixtures: write byte-identical assets once in the default assets/ output

クローズ
#469 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #470 @silverbackdan による — マージ済み

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php, symfony
領域
tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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:

  • StoredFileExporter keys what it has written by the content's sha256. Content it has already written returns the existing name, so every new 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 two new 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.

主要言語
PHP
スター
32
フォーク
8
平均マージ
1時間 1分
マージ済み PR(30日)
159

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

components-web-app/api-components-bundle のほかの issue

components-web-app/api-components-bundle の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。