Limit search-replace in DB --wp_db_id="wp_posts:1234" (New command parameter)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start at the wp search-replace command entry point and inspect how it selects database tables and records. Add support for the table:id form, including the documented WordPress ID mappings and optional comma-separated IDs. Done means a dry run changes only the requested records while existing unrestricted searches continue to work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I often want to apply the wp search-replace command to only one single database record. (Sometimes for testing, sometimes, because I know, that I only have to replace data in one post.) Most often it's a single post ID in wp_posts.
Current situation:
The following command makes a dry run to replace "each and every" match of class="old". It's not possible to limit it to one id of a specific WordPress table.
wp search-replace 'class="old"' 'class="new"' --log --dry-run
Feature request
Add a new command parameter (--wp_db_id="") to set the database table name and the id of a record in order to limit the search-replace command.
--wp_db_id="wp_posts:123"
The correct id field for each WordPress entity is mapped automatically internally. See example below.
Mapping example
--wp_db_id="wp_posts:123"(translates internally into wp_posts.ID=123)--wp_db_id="wp_options:789"(translates into wp_options.option_id=789)--wp_db_id="wp_terms:1823"(translates into wp_terms.term_id=1823)
--wp_db_id="{WordPress table name}:{id}"
New command demo
The new command looks like this. It only replaces the record with wp_options.option_id=789.
wp search-replace 'class="old"' 'class="new"' --wp_db_id="wp_options:789" --log --dry-run
Exra feature: Comma separated list of ids
May it's also possible, to add more than one id.
--wp_db_id="wp_terms:1823,1233,2399"
- Ngôn ngữ chính
- Gherkin
- Star
- 61
- Fork
- 47
- Merge trung bình
- 8 phút
- Pull request đã merge (30 ngày)
- 1
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/search-replace-command
-
bug command:search-replace scope:distribution state:unconfirmed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
wp-cli/search-replace-command#231 · 5 bình luận ·
-
command:search-replace
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
wp-cli/search-replace-command#194 · 1 bình luận ·
-
command:search-replace contributor-day
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
wp-cli/search-replace-command#186 · 2 bình luận · 11 reaction ·
-
command:search-replace
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
wp-cli/search-replace-command#137 · 6 bình luận · 4 reaction ·
-
Progress bar Đang mởcommand:search-replace
wp-cli/search-replace-command#134 · 1 bình luận · 6 reaction · 1 người được giao ·
Tất cả issue của wp-cli/search-replace-command
Issue tương tự
-
P3 tool/tts type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
NousResearch/hermes-agent#117794 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
AvengeMedia/DankMaterialShell#3523 ·