SQLite path resolution misses db-path.php secret path
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Start with src/DB_Command_SQLite.php:65-99 and compare its path resolution with Automattic/wp-cli-sqlite-command/src/SQLiteDriverFactory.php:46-78 and the drop-in logic in wp-includes/sqlite/db.php:50-56. Reproduce with DB_PATH outside wp-content/database before FQDB is defined, then check the wp db file-path commands. Done when those commands resolve the explicit or recorded database path instead of the default .ht.sqlite.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
DB_Command_SQLite::get_sqlite_db_path() (src/DB_Command_SQLite.php:65-99) only checks, in order:
FQDBconstant,FQDBDIR+DB_FILE, defaulting to<wp-content>/database/.ht.sqlite,- a few hardcoded legacy fallbacks.
Since sqlite-database-integration 3.1, the canonical resolution lives in the drop-in (wp-includes/sqlite/db.php:50-56):
if ( defined( 'DB_PATH' ) ) {
$database_storage = WP_SQLite_Storage::with_explicit_path( DB_PATH );
} elseif ( defined( 'FQDB' ) ) {
$database_storage = WP_SQLite_Storage::with_explicit_path( FQDB );
} else {
$database_storage = WP_SQLite_Storage::with_secret_path( FQDBDIR );
}
with_secret_path() reads the recorded randomized path from db-path.php (class-wp-sqlite-storage.php:118-126,386-407), migrating legacy .ht.sqlite (:204-210). Sites that set an explicit DB_PATH outside the web root (in our case, .local/sqlite/wordpress.sqlite via WP_DB_PATH) cannot be located by wp db * file-path operations whenever the drop-in has not yet defined FQDB. Until then, wp db export, size, and reset resolve the wrong file or report a missing database.
The sibling package already handles this. See Automattic/wp-cli-sqlite-command/src/SQLiteDriverFactory.php:46-78, which resolves DB_PATH → FQDB → FQDBDIR/db-path.php (@include) → legacy .ht.sqlite → with_secret_path(FQDBDIR)->initialize().
Proposed change
The same chain should be mirrored in get_sqlite_db_path(): check DB_PATH first, then FQDB, then @include FQDBDIR/db-path.php, then legacy .ht.sqlite. Alternatively, once the drop-in is loaded, the function could return the already-resolved FQDB, which the drop-in re-defines from the resolved path at db.php:75-77.
Repro
Set DB_PATH to a file outside wp-content/database, with no FQDB defined yet at the point wp db resolves the path. Run any wp db file-path subcommand. It targets <wp-content>/database/.ht.sqlite.
- Ngôn ngữ chính
- PHP
- Star
- 76
- Fork
- 74
- Merge trung bình
- 2 giờ 50 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 wp-cli/db-command
-
db tail commandĐang mởcommand:db status:unconfirmed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
wp-cli/db-command#359 ·
-
Size: separate data_length and index_lengthCó thể đã có người làm @swissspidy đã nhận 57 ngày trước. Đang mởcommand:db-size scope:documentation
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
wp-cli/db-command#348 · 1 bình luận ·
-
query shouldn't require mysql/mariadb cli toolsCó thể đã có người làm @swissspidy đã nhận 223 ngày trước. Đang mởbug command:db-query
wp-cli/db-command#319 · 5 bình luận · 1 reaction · 2 người được giao ·
-
Add `wp db status` command for quick database health overviewCó thể đã có người làm @swissspidy đã nhận 283 ngày trước. Đang mởcommand:db scope:distribution state:unconfirmed
wp-cli/db-command#306 · 5 bình luận · 1 reaction · 2 người được giao ·
-
Giving multiple same arguments to mysqldump (via wp db export) only forwards the latestCó thể đã có người làm @astappiev đã nhận 398 ngày trước. Đang mởbug command:db-export
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
wp-cli/db-command#289 · 3 bình luận ·
Tất cả issue của wp-cli/db-command
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 3 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Sync EN] Formatting improvements to "Large Objects (LOBs)" docs (#6056)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởsync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Перевод устарел
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
repo:cms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
craftcms/cms#20613 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày