Limit search-replace in DB --wp_db_id="wp_posts:1234" (New command parameter)
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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"
- 主要言語
- Gherkin
- スター
- 61
- フォーク
- 47
- 平均マージ
- 8分
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wp-cli/search-replace-command のほかの issue
-
bug command:search-replace scope:distribution state:unconfirmed
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
wp-cli/search-replace-command#231 · コメント 5 件 ·
-
command:search-replace
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
wp-cli/search-replace-command#194 · コメント 1 件 ·
-
command:search-replace contributor-day
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
wp-cli/search-replace-command#186 · コメント 2 件 · リアクション 11 件 ·
-
command:search-replace
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
wp-cli/search-replace-command#137 · コメント 6 件 · リアクション 4 件 ·
-
Progress bar オープンcommand:search-replace
wp-cli/search-replace-command#134 · コメント 1 件 · リアクション 6 件 · 担当者 1 名 ·
wp-cli/search-replace-command の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
milvus-io/birdwatcher#545 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
area:tools bug good first issue help wanted priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
TaewoooPark/Motifcode#14 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
newrelic-experimental/preflight#793 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
caddyserver/caddy#8046 ·