Skip to content

filemanager_path / rb_base_dir をDB管理からconfig管理へ移行#388

Open
yama wants to merge 8 commits intomainfrom
codex/update-config-api-logic
Open

filemanager_path / rb_base_dir をDB管理からconfig管理へ移行#388
yama wants to merge 8 commits intomainfrom
codex/update-config-api-logic

Conversation

@yama
Copy link
Member

@yama yama commented Feb 1, 2026

概要

  • 環境依存の filemanager_path / rb_base_dir をDBではなく config.inc.php で管理する方針に変更
  • それに伴い、インストーラ生成と env 優先解決の挙動を整合

Copilot AI review requested due to automatic review settings February 1, 2026 06:09
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17fba38ce9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +83 to +84
'filemanager_path' => '',
'rb_base_dir' => '',

Choose a reason for hiding this comment

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

P2 Badge 新規インストール時のパス既定値が空になる

ここで filemanager_pathrb_base_dir の既定値を空文字に変更したため、新規インストール時は install/instprocessor.php が既存 config.inc.php / system_settings を参照できないケースで空のまま config.inc.php に書き込まれます。結果として config('filemanager_path') / config('rb_base_dir') が空になり、manager/actions/element/files.dynamic.phpmanager/media/browser/... が期待するルートパスが未設定のままになってファイルマネージャ/ファイルブラウザが利用できなくなります(手動で設定を保存するまで復旧しない)。

Useful? React with 👍 / 👎.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents filemanager_path and rb_base_dir from being lost during upgrades by migrating these settings from the database to the config file, with environment variable support as the top priority.

Changes:

  • Added logic to preserve existing filemanager_path and rb_base_dir values from config files during installation/upgrade
  • Implemented environment variable support (MODX_FILEMANAGER_PATH, MODX_RB_BASE_DIR) with fallback to config file values
  • Prevented these path settings from being inappropriately saved to or read from the database

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
install/instprocessor.php Added functions to read path settings from existing config file and system_settings table, populate config template placeholders, and delete migrated settings from database
install/tpl/config.inc.tpl Updated template to output filemanager_path and rb_base_dir with env() wrapper for environment variable support
manager/includes/document.parser.class.inc.php Added resolvePathConfig() method to prioritize environment variables over global variables for path resolution
manager/includes/config_check.inc.php Removed direct database queries for these settings, now uses evo()->config() with safe empty string handling
manager/processors/save_settings.processor.php Added guards to skip these path settings in the save loop and added safe empty string checks in setPermission()
manager/includes/default.config.php Changed default values from MODX_BASE_PATH-based paths to empty strings since values are now resolved elsewhere

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yama yama changed the title インストーラ: アップグレード時に filemanager_path / rb_base_dir を既存 config から優先取得して破棄を防止 filemanager_path / rb_base_dir をDB管理からconfig管理へ移行 Feb 1, 2026
yama added 7 commits February 1, 2026 15:24
## 主な変更内容

**環境依存パス設定を `config.inc.php` に移行**

データベースで管理していた `filemanager_path` と `rb_base_dir` を `config.inc.php` での管理に変更し、環境依存設定をコード管理可能にしました。

### 変更詳細

1. **パス設定の読み込み改善**
   - `ex_dbapi.php`: `config.inc.php` 読み込み前に `global` 宣言を追加し、パス変数をグローバルスコープに正しく格納
   - `DocumentParser::getSettings()`: グローバル変数でDBの設定値を上書きし、`config.inc.php` の値を優先

2. **グローバル設定画面の対応**
   - `functions.inc.php`: グローバル設定表示時に `config.inc.php` の値を反映
   - `save_settings.processor.php`: 設定保存時に `config.inc.php` を更新する `update_config_inc()` 関数を実装
   - 変更がない場合はファイル更新をスキップし、不要なパーミッション変更を回避

3. **テンプレート統合**
   - config.inc.tpl: インストーラのテンプレートをコア領域に移動
   - `instprocessor.php`: コア側のテンプレートを参照するように変更
   - SSOT原則に従い、テンプレートを1箇所で管理

### 影響範囲

- 新規インストール: `config.inc.php` でパス設定を管理
- 既存環境: グローバル設定を保存すると `config.inc.php` が自動更新される
- 設定値は環境変数 (`MODX_FILEMANAGER_PATH` / `MODX_RB_BASE_DIR`) でのオーバーライドに対応
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant