WP-CLI リファレンス (Pro)
シェルからのバックアップ、復元、インポート、インストーラーの展開、災害復旧、ステージングを自動化します。 Multisite Migrate 管理 UI と完全に同等 - ヘルプを除くすべてのコマンドに Pro ライセンスが必要です。
要件
- WP-CLI installed on the server (or SSH session).
- Multisite Migrate が有効です。コマンドは WordPress のルートで実行します(
wpがサイトを読み込む必要があります)。 - プロライセンス — every command except
helprequires Multisite Migrate Pro. Plus and Free licenses cannot use WP-CLI. - WordPress capability:
manage_options(single site) ormanage_network(multisite network tasks).
はじめに
wp multisite-migrate help
wp multisite-migrate help --topic=restore
wp multisite-migrate backup --help
wp multisite-migrate list help prints a full command tree, capability notes, and copy-paste examples. Use --topic=backup|restore|import|jobs|installer|recovery|staging|caps to filter sections. Per-command flags are documented with native WP-CLI --help.
コマンドツリー
| コマンド | 目的 |
|---|---|
backup | バックアップ ジョブを実行します (ローカルおよびオプションのクラウド アップロード) |
restore <job-id> | トポロジ オプションを使用した同一サーバーの復元または URL 移行 |
import | ディスク、URL、またはクラウドからアーカイブを登録します。オプションの連鎖リストア |
list | 完了したバックアップまたは復元ジョブをリストする |
status <job-id> | ジョブの進行状況、パーセント、メタデータ |
cancel <job-id> | 実行中のジョブをキャンセルする |
delete <job-id> | ジョブレコードとローカルアーカイブが存在する場合は削除します |
prefetch <job-id> | 復元前にクラウドのみのバックアップをダウンロードする |
manifest <job-id> | アーカイブ マニフェスト JSON を印刷します |
migration-preview <job-id> | 移行用の URL とテーブル マッピングをプレビューする |
info | プラグインのバージョン、エンジン、ライセンスの概要 |
health | PHP 拡張機能、ディスク容量、ストレージ パス |
cleanup | 一時インポート ファイルとワーカー ファイルを削除する |
prune | 古いローカル バックアップに保持ポリシーを適用する |
installer | バックアップの横にインストーラーを展開するか、ブートストラップ PHP をダウンロードします |
recovery | 災害復旧ポイントを設定、起動、またはリセットする |
list-remote <channel> | リモート バックアップの一覧表示 (gdrive、s3、sftp、dropbox) |
staging | ステージング サブサイトを作成、削除、またはプッシュする |
help | このリファレンスを端末で印刷します |
バックアップ
wp multisite-migrate backup
wp multisite-migrate backup --upload --destination=gdrive
wp multisite-migrate backup --scope=network --profile=full
wp multisite-migrate backup --scope=subsite --profile=db --incremental Common flags: --upload, --destination=local|gdrive|s3|sftp|ftp|dropbox, --scope=network|subsite, --profile=full|db|files|media|plugins|themes|custom, --incremental, --quiet.
クラウドアップロードには、Plus/Pro クラウドストレージが設定されている必要があります。 クラウドストレージ。ネットワーク管理者は、Free+ のネットワーク スコープを利用できます。 subsite-admin ネットワーク ジョブは引き続きシート/機能ルールに従います。
復元
wp multisite-migrate restore 42 --yes
wp multisite-migrate restore 42 --mode=db --no-safety-snapshot
wp multisite-migrate restore 42 --migration --old-url=https://old.example --new-url=https://new.example --yes トポロジーフラグは管理画面の マルチサイト復元 に対応します:
--topology-import=subsite_on_network+--topology-target-url=…— サブサイトバックアップを既存ネットワークへ--topology-import=network_to_subsite+--topology-target-blog-id=…— ネットワークバックアップをサブサイト枠へ--prefix-policy=keep_source|remap_wp,--blog-domains=<json>,--passphrase=…(.venc用)- 共有ユーザーのマージ(2 つのネットワーク着地モードでは既定でオン):
--user-merge/--no-user-merge,--uid-fields=_customer_user,_other_meta,--reset-imported-passwords,--send-password-reset-email
wp multisite-migrate restore 42 --topology-import=subsite_on_network --topology-target-url=https://network.example/site/ --user-merge --uid-fields=_customer_user --yes 長い復元では進捗バーが表示されます。セーフティスナップショットは --no-safety-snapshot が無い限り実行されます。上書き確認をスキップするには --yes を使います。
インポート
wp multisite-migrate import /var/backups/site.zip
wp multisite-migrate import --url=https://cdn.example/backup.zip
wp multisite-migrate import --from=gdrive --remote-id=FILE_ID --name=site.zip
wp multisite-migrate import /path/archive.zip --restore --via-worker --yes リモート URL とクラウド経由は Pro が必要です(CAP_REMOTE_IMPORT)。すぐ復元するには --restore を続けます。インストーラーではなくプラグイン内で復元するには --via-worker を足します。
Push と Pull(サイト間の直接転送)
wp multisite-migrate pull https://remote.example niCyq5iEWxEg5LXXPjHL4zMNLBMovP3V --include-tables=wp_posts,wp_postmeta
wp multisite-migrate push https://remote.example niCyq5iEWxEg5LXXPjHL4zMNLBMovP3V --media=compare --backup=selected
wp multisite-migrate pull https://remote.example <key> --find=https://remote.example --replace=https://local.test
wp multisite-migrate push https://remote.example <key> --theme-files=all --preserve-active-plugins Multisite Migrate Pro を入れた2つのサイトの間で、サイトを止めずにテーブルとファイルを転送します。データは署名付き HTTP パケット(HMAC-SHA256)で渡り、ZIP は作らずダウンロードもしません。
- 鍵と許可: 鍵は相手サイトの設定 → リモートアクセスにあります。Pull には
peer_allow_pull、Push にはpeer_allow_pushが必要です。 --include-tables=<csv>— カンマ区切りのテーブル名。空のときはサイト接頭辞のテーブルをすべて転送します。--find=<url>/--replace=<url>— 追加の検索と置換。シリアライズされたデータも対象です。--media=compare|all|since|off—compareは無いか新しいアップロードだけ、allはすべて、since=<日付>はその日以降、offはアップロードしません。--theme-files=all|off— テーマファイルを転送します。--backup=selected|prefix|off— 入れ替え前に宛先テーブルを保存します(既定:selected)。--preserve-active-plugins— 宛先の有効プラグインをそのままにします。--skip-replace-guids— GUID 列の URL は置換しません。--exclude-spam— スパムコメントは転送しません。--subsite=<id>— 特定のサブサイトだけに限ります。
ジョブ管理
wp multisite-migrate list --type=backup --format=table --limit=50
wp multisite-migrate status 42
wp multisite-migrate cancel 42
wp multisite-migrate delete 42
wp multisite-migrate manifest 42
wp multisite-migrate migration-preview 42 list supports --format=table|json|csv. Subsite admins on multisite see only their scope unless they have network cap.
インストーラーと空のサーバー
wp multisite-migrate installer 42
wp multisite-migrate installer 42 --bridge
wp multisite-migrate installer ダウンロード --type=php
wp multisite-migrate installer ダウンロード 42 --type=php 同じウィザードをデプロイします インポート → インストーラーを開く. --bridge は、アーカイブが保護されているとき wp-admin の MU プラグイン代理を使います。 ダウンロード はシェルのそばに起動用 PHP を書き出します(Pro CAP_INSTALLER)。
See also 空サーバー移行.
災害復旧
wp multisite-migrate recovery set --job-id=42
wp multisite-migrate recovery status
wp multisite-migrate recovery launch
wp multisite-migrate recovery reset 一致 バックアップ → リカバリ: in-place overwrite from a pinned full backup with WordPress core. Disable site-wide with define('MM_DISALLOW_RECOVERY', true); in wp-config.php.
ステージング
wp multisite-migrate staging create --slug=staging --title="Staging"
wp multisite-migrate staging delete --slug=staging
wp multisite-migrate staging push --job-id=42 Requires Pro CAP_STAGING. Same flows as リストアガイドの Staging.
メンテナンス
wp multisite-migrate info
wp multisite-migrate health
wp multisite-migrate cleanup
wp multisite-migrate prune
wp multisite-migrate list-remote gdrive ライセンス機能
Pro ゲートの後、個々のコマンドには二次的な機能 (管理 UI と同じ) が必要になる場合があります。
| 能力 | CLI の例 |
|---|---|
CAP_CLI | All commands except help — Pro only |
CAP_CLOUD | backup --upload, prefetch, list-remote |
CAP_REMOTE_IMPORT | import --url, import --from=* |
CAP_MULTISITE | マルチサイト機能ゲートを必要とするネットワーク全体の管理フロー (CLI ヘルプを参照) |
CAP_INSTALLER | installer ダウンロード |
CAP_STAGING | staging * |
CAP_NETWORK_SPLIT | split-network, split-status, split-cancel, split-resume, restore --topology-import=extract_site_standalone |
シナリオレシピ
| シナリオ | コマンド |
|---|---|
| サブサイト → スタンドアロン移行 | wp multisite-migrate restore <id> --migration --old-url=… --new-url=… --yes |
| 分割ネットワーク → サイトごとのアーカイブ | wp multisite-migrate split-network --yes then split-status — see ネットワーク分割ガイド |
| 失敗した分割を再開する | wp multisite-migrate split-resume --yes then split-status |
| ネットワーク アーカイブ → 1 つのサイト スタンドアロン | wp multisite-migrate restore <id> --migration --topology-import=extract_site_standalone --source-blog-id=N --old-url=… --new-url=… --yes then migration-verify |
| 残った URL を確認する | wp multisite-migrate migration-verify --old-url=… |
| 検索置換を確認しました | wp multisite-migrate search-replace --old=… --new=… --yes |
| サブサイト → 既存のネットワーク (ユーザーを統合) | wp multisite-migrate restore <id> --topology-import=subsite_on_network --topology-target-url=… --user-merge --yes |
| ネットワーク → サブサイト スロット (ユーザーをマージ) | wp multisite-migrate restore <id> --topology-import=network_to_subsite --topology-target-blog-id=… --user-merge --yes |
| ユーザーマージを行わないネットワークインポート | wp multisite-migrate restore <id> --topology-import=subsite_on_network --topology-target-url=… --no-user-merge --yes |
| ユーザーを結合 + パスワードをリセット | wp multisite-migrate restore <id> --topology-import=subsite_on_network --topology-target-url=… --user-merge --reset-imported-passwords --send-password-reset-email --yes |
| インポートしてからインストーラー | wp multisite-migrate import /path/backup.zip --restore |
| インポートしてからプラグイン内で復元 | wp multisite-migrate import /path/backup.zip --restore --via-worker --yes |
| クラウド専用バックアップ→復元 | wp multisite-migrate prefetch <id> then wp multisite-migrate restore <id> --yes |
| インストーラーのデプロイ (ブリッジ) | wp multisite-migrate installer <id> --bridge |
| 災害復旧ポイント | wp multisite-migrate recovery set --job-id=<id> then recovery launch |
グローバルフラグ
--quiet— suppress progress messages on long jobs--porcelain— machine-readable progress lines
関連ガイド
WP-CLI よくある質問
シェルの自動化には Pro が必要です。ライブコマンドリストについては、サーバー上のヘルプを使用してください。
WP-CLI にはどのライセンスが必要ですか ?
Pro。Free および Plus では、Multisite Migrate WP-CLI コマンドを実行できません (ヘルプが表示される場合を除く)。
Wp コマンドはどこで実行すればよいですか ?
WordPress ルートから WP-CLI がサイトをロードします。Multisite Migrate プラグインがアクティブである必要があります。
CLI を使用してスケジュールを自動化できますか ?
Pro でははい — バックアップ、復元、インポート、インストーラー、リカバリ、およびステージングのコマンドは管理 UI を反映します。上記のレシピセクションを参照してください。
WP-CLI 経由でネットワークに復元するときにユーザーを結合するにはどうすればよいですか ?
--topology-import=subsite_on_network または network_to_subsite を使用します。共有ユーザーの結合はデフォルトでオンになっています。--no-user-merge を渡してスキップするか、必要に応じて --uid-fields と --reset-imported-passwords を渡します。上記の復元セクションとレシピを参照してください。
WP-CLI のみを使用する場合、14日の返金は適用されますか ?
はい。新しい Plus または Pro の購入には、管理 UI と WP-CLI のどちらを好むかに関係なく、14日間の返金保証が含まれます。