get-lancer-php56 設定來源
目的
記錄 /Users/mattsu/Documents/Site/get-lancer-php56 legacy CakePHP 專案的主要設定來源與查詢順序。
這份文件只記來源與 key 名稱,不記 secret 值。
主要檔案
| 路徑 | 用途 |
|---|---|
app/Config/settings.yml | legacy 產品 / feature / 語系 / email / Redis / social / quote 等 YAML 設定 |
app/Config/core.php | CakePHP core 設定,包含 session、security salt/cipherSeed、timezone、ACL 等 |
app/Config/database.php | CakePHP datasource 設定,包含 default/master/slave 等 DB connection |
app/Config/bootstrap.php | CakePHP bootstrap,載入常數、settings、plugin 或初始化邏輯 |
app/Config/constants.php | legacy 常數集中檔,許多流程會依賴寫死常數 |
app/Config/config.php | legacy 額外設定入口 |
app/Config/routes.php | CakePHP route 設定 |
app/Config/cms_routes.php | CMS/localize route 規則,會被 routes.php require |
app/Lib/RedisUtil.php | Redis cache / lock helper,讀取 RedisSession.* |
app/Plugin/HighPerformance/Config/bootstrap.php | RedisSession / Memcached / 高效能 plugin 啟用入口 |
設定分類
DB
主要來源:
app/Config/database.php常見 connection name:
default
master
slave / replica 類 connection不要把 host、username、password 寫進文件。若要比對新舊 DB,記錄 connection name 與使用情境即可。
時區
主要來源:
app/Config/core.php
app/Config/config.php常見設定 key / function:
date_default_timezone_set(...)
Configure::write('Config.timezone', ...)目前掃描到 legacy 有 timezone 設定在 core.php,部分設定與補載入邏輯也在 config.php。實際值請查原檔;migration 時不要只看全域 timezone,還要看該 controller / model 是否局部使用 Asia/Taipei 或轉 UTC。
時間寫法與資料表時間欄位規則見 時區、語系與時間寫法設定來源。
語系
主要來源:
app/Config/settings.yml常見 key:
site.language
user.is_allow_user_to_switch_languageRedis
主要來源:
app/Config/settings.yml
app/Config/core.php
app/Lib/RedisUtil.php
app/Plugin/HighPerformance/Config/bootstrap.php常見 key:
RedisSession.is_redis_session_enabled
RedisSession.hostname
RedisSession.port另有 Cake Cache config:
redis_mins
redis_hour
redis_days詳細規則見 Redis。
Security
主要來源:
app/Config/core.php常見 key:
Security.salt
Security.cipherSeed這兩個是敏感設定,不要在文件貼完整值。
排查順序
- 先確認 legacy API / model 是否讀 CakePHP
Configure、YAML setting,或直接使用 constant。 - DB 先看
database.php的 connection name,不要先複製 host/password。 - 時區 / security 先看
core.php;若流程有局部DateTimeZone、date()、NOW(),以該流程實際寫法為準。 - 產品功能開關、語系、email、Redis、quote 相關設定先看
settings.yml;Cake Cache Redis 另看core.php。 - 若 legacy 行為和 new API 不一致,再回到
constants.php或 plugin model 裡找寫死常數。 - 若是 path / route 差異,先看
app/Config/routes.php、cms_routes.php,再看 controller action 是否由 CakePHP convention 直接解析。
和 new API 對照
| 類型 | legacy | new API |
|---|---|---|
| DB | app/Config/database.php | Lib/Common/Configuration.php + DBFactory |
| timezone | app/Config/core.php | local_timezone / display helper |
| language | settings.yml | default_lang, use_multi_langs, translation tables |
| Redis | settings.yml / core.php / RedisUtil | Configuration.php + RedisUtil |
| log / Slack | CakePHP / legacy log helpers | LogHelper, MySlackHandler, Monolog tables |
| security | Security.salt, Security.cipherSeed | API key / session / JWT / project constants |
| route / path | routes.php, cms_routes.php, CakePHP controller/action convention | RouterV3 + RouterRule/Mapping.php / Origin.php / File.php |