Skip to content

fix: 郵便番号CSVのダウンロードURLを新URLへ変更 - #1425

Open
nanasess wants to merge 4 commits into
EC-CUBE:masterfrom
nanasess:fix/zip-download-url
Open

fix: 郵便番号CSVのダウンロードURLを新URLへ変更#1425
nanasess wants to merge 4 commits into
EC-CUBE:masterfrom
nanasess:fix/zip-download-url

Conversation

@nanasess

@nanasess nanasess commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

日本郵便の郵便番号CSV(ken_all.zip)配布URLが変更され、旧URLが404を返すようになったため、ZIP_DOWNLOAD_URL を新URLへ更新します。

URL HTTP Content-Type
旧: https://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip 404 text/html
新: https://www.post.japanpost.jp/service/search/zipcode/download/kogaki/zip/ken_all.zip 200 application/zip (約1.69MB)

旧URLが404となったことで、管理画面「基本情報管理 > 郵便番号DB登録」の自動更新(update_csv/auto)が動作しなくなっていました。

変更点

  • data/mtb_constants_init.php: ZIP_DOWNLOAD_URL 定数のフォールバック値を新URLへ変更
  • html/install/sql/insert_data.sql: 新規インストール時に mtb_constants へ投入される値を新URLへ変更
  • data/migrations/Version20260714000001_UpdateZipDownloadUrl.php: 既存環境の mtb_constants を新URLへ更新するマイグレーションを追加(管理画面で独自URLへ変更済みの環境を上書きしないよう、値が旧URLの場合のみ更新)

既存環境への反映についての注意

ZIP_DOWNLOAD_URL は定数キャッシュ (data/cache/n.php) 経由で参照されます。マイグレーションで mtb_constants(DB) を更新しても、定数キャッシュには即時反映されません。 反映には管理画面「システム設定 > パラメータ設定」での保存操作(キャッシュ再生成)が必要です。

Test plan

  • マイグレーション適用後、mtb_constantsZIP_DOWNLOAD_URL が新URLへ更新されること
  • 管理画面「システム設定 > パラメータ設定」で保存後、新規インストール/既存環境ともに「郵便番号DB登録」の自動更新が成功すること
  • 新URLから ken_all.zip が取得・展開され mtb_zip へ登録されること

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 変更
    • 郵便番号CSV(ZIPアーカイブ)の取得元URLを更新しました。
    • 既存環境では旧URLの定数のみ新URLへ更新。ロールバックは新URLが設定されている場合に限り旧URLへ戻します。
    • 定数キャッシュは即時反映されないことがあります(管理画面で保存・再生成が必要)。
    • 初期導入時の登録データも新URLへ差し替えました。

nanasess and others added 2 commits July 14, 2026 17:55
日本郵便のken_all.zip配布URLが変更され、旧URL
(https://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip)
が404を返すようになったため、新URL
(https://www.post.japanpost.jp/service/search/zipcode/download/kogaki/zip/ken_all.zip)
へ更新する。

- data/mtb_constants_init.php: ZIP_DOWNLOAD_URL 定数のフォールバック値
- html/install/sql/insert_data.sql: 新規インストール時に mtb_constants へ投入される値

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
既存環境の mtb_constants に登録済みの ZIP_DOWNLOAD_URL を新URLへ更新する
マイグレーションを追加する。管理画面で独自URLへ変更済みの環境を上書きしないよう、
値が旧URLの場合のみ更新する。

なお DB 更新のみでは定数キャッシュ(data/cache/n.php)へ即時反映されないため、
反映には管理画面「システム設定 > パラメータ設定」での保存操作が必要。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e427eb4c-4303-4a9b-99f7-1d1a7c1b3b55

📥 Commits

Reviewing files that changed from the base of the PR and between b2f2caa and 38574f3.

📒 Files selected for processing (1)
  • data/migrations/Version20260714000001_UpdateZipDownloadUrl.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • data/migrations/Version20260714000001_UpdateZipDownloadUrl.php

📝 Walkthrough

Walkthrough

郵便番号ZIPアーカイブの取得先URLを新しいパスへ変更し、初期データ・インストールSQL・既存環境向けマイグレーションに反映しています。

Changes

郵便番号ZIP URL更新

Layer / File(s) Summary
URL更新とマイグレーション
data/migrations/Version20260714000001_UpdateZipDownloadUrl.php, data/mtb_constants_init.php, html/install/sql/insert_data.sql
初期データとインストールSQLのZIP_DOWNLOAD_URLを新URLへ変更し、旧URLと一致する場合のみ新旧URLを切り替えるマイグレーションを追加しています。

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: nobuhiko, seasoftjapan

Poem

うさぎが跳ねて、URLぴょん
古い道から新しい道へ
ZIPを探して風に乗る
戻る道も用意して
郵便番号を届けるぴょん!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 郵便番号CSVのダウンロードURLを新URLへ変更する内容で、変更点の मुख्य旨を正しく要約しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.23%. Comparing base (1d61741) to head (38574f3).
⚠️ Report is 20 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1425      +/-   ##
==========================================
+ Coverage   56.20%   56.23%   +0.03%     
==========================================
  Files          87       87              
  Lines       11090    11091       +1     
==========================================
+ Hits         6233     6237       +4     
+ Misses       4857     4854       -3     
Flag Coverage Δ
tests 56.23% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@data/migrations/Version20260714000001_UpdateZipDownloadUrl.php`:
- Around line 29-30: Update the migration SQL in
Version20260714000001_UpdateZipDownloadUrl to use parameter placeholders with
$this->sql() instead of concatenating self::NEW_URL and self::OLD_URL into the
query. Bind both URL constants through the migration’s supported params
mechanism while preserving the existing update conditions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b070ef36-a839-44da-910d-d30d021ad004

📥 Commits

Reviewing files that changed from the base of the PR and between 93b9886 and fc09ceb.

📒 Files selected for processing (3)
  • data/migrations/Version20260714000001_UpdateZipDownloadUrl.php
  • data/mtb_constants_init.php
  • html/install/sql/insert_data.sql

Comment thread data/migrations/Version20260714000001_UpdateZipDownloadUrl.php
nanasess and others added 2 commits July 23, 2026 09:33
CodeRabbit の指摘に対応し、ZIP_DOWNLOAD_URL 更新マイグレーションの
UPDATE 文を文字列連結からプレースホルダ (?) + params バインドへ変更。
id / name の3値すべてをバインドし、SQL の扱いを一貫させる。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b2f2caa のプレースホルダ化を取り消し、文字列連結方式へ戻す。

継承元 Eccube2\Migration\Migration::sql() のシグネチャは
sql(string $sql, ?string $pgsql, ?string $sqlite) であり、第2引数は
params 配列ではなく pgsql/sqlite 用のSQL派生文字列。内部の execute() も
プレースホルダバインドをサポートしないため、配列を渡すと
TypeError となり pgsql マイグレーションが失敗していた。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant