GravityKit\GravityMigrate\CLI\Migrate
Migrate Gravity Forms + GravityKit data (forms, entries, Views, and the pages that
embed them) from the command line: export a portable bundle, import one, inspect one,
or reset stuck migration state -- and move forms between Gravity Forms and the other
form plugins (plugins, to, from).
Both export and import drive the same batch state machine the browser UI uses (the
Export/Import AJAX route closures), run to completion synchronously. The AJAX
die-on-error handlers are disabled under WP-CLI (see Import::set_error_environment()).
to and from call the same provider objects the wizard's AJAX controllers call, through
\ExternalMigration. They deliberately do not go through those controllers:
validate_request() requires a nonce and CoreHelpers::process_return() sends JSON and dies,
neither of which survives WP-CLI. The checks the controllers apply are applied there instead.
Since:
1.2.0%ver% Addsplugins,toandfrom.
Source: src/CLI/Migrate.php:39
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\CLI - Extends:
WP_CLI_Command
Methods
| Method | Description |
|---|---|
export() | Exports Gravity Forms + GravityKit data to a portable ZIP bundle. |
import() | Imports a GravityMigrate ZIP bundle into this site. |
inspect() | Inspects a bundle without importing: prints its forms, data types, and source URL, |
status() | Reports current migration state: whether an import lock is held (and whether |
reset() | Clears stuck migration state: temporary tables, extracted import files, and the |
plugins() | Lists the form plugins this site can move forms to and from. |
to() | Moves Gravity Forms forms into another form plugin. |
from() | Brings forms from another form plugin into Gravity Forms. |
Method Reference
export()
public function export( $args, $assoc_args )
Exports Gravity Forms + GravityKit data to a portable ZIP bundle.
OPTIONS
--forms=<ids> : Comma-separated form IDs to export, or "all".
default: entries,views,posts
[--date-start=<Y-m-d>] : Only export entries created on or after this date.
[--date-end=<Y-m-d>] : Only export entries created on or before this date.
[--password=<password>] : Encrypt the ZIP (AES-256).
[--include-files]
: Package the uploaded files the forms and entries reference INSIDE the bundle, rather
than leaving the importing site to download each one from here. Use it when this site is
not reachable from the destination -- a local development site, a site behind HTTP auth,
or one about to be switched off. The bundle gets much larger, and files beyond
80% of this site's own upload limit are left out and still downloaded on import; filter
gk/gravitymigrate/export/file-size-limit to change that.
[--public-url=<url>] : Rewrite this site's origin to <url> in exported file-upload URLs, page content, and info.json (src_url/uploads_dir). Use it when exporting from a site whose stored URL is not reachable from the destination (e.g. a demo clone's internal host) so uploads download on import. The URL must be public and resolvable from the importing server.
[--output=<path>] : Copy the finished ZIP to this path (the export directory is auto-deleted after 3 hours).
[--porcelain] : Output only the resulting ZIP path.
[--format=<format>] : Summary format.
default: table options:
- table
- json
EXAMPLES
wp gk migrate export --forms=2 --data=entries,views,posts \
--public-url=https://gravityview--abc123.demo.gravitykit.com \
--output=/srv/bundles/abc123.zip --porcelain
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$args | |||
$assoc_args |
Source: src/CLI/Migrate.php:155
import()
public function import( $args, $assoc_args )
Imports a GravityMigrate ZIP bundle into this site.
Imports are not resumable: a failed import prints the form IDs it committed before the failure, so you can remove them and re-run.
OPTIONS
<zip> : Path to the GravityMigrate export ZIP.
default: all
[--password=<password>] : ZIP password if it was encrypted.
[--skip-uploads] : Do not download entry file uploads.
[--download-timeout=<secs>] : Per-hop timeout for downloading a linked entry file upload. Overrides the gk/gravitymigrate/import/download-timeout filter (default 300 seconds).
[--max-download-bytes=<n>] : Maximum bytes accepted for a single downloaded entry file upload. Overrides the gk/gravitymigrate/import/max-download-bytes filter (default 100 MB).
[--max-dump-file-size=<n>] : Maximum allowed size, in bytes, of the bundle's SQL dump file. Overrides the gk/gravitymigrate/import/max-dump-file-size filter (default 2 GB).
[--format=<format>] : Summary format.
default: table options:
- table
- json
[--yes] : Skip the confirmation prompt (import writes into Gravity Forms tables).
[--porcelain] : Output only the newly-created form IDs, one per line, for scripting.
EXAMPLES
wp gk migrate import bundle.zip --user=admin --yes
wp gk migrate import bundle.zip --user=admin --yes --porcelain
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$args | |||
$assoc_args |
Source: src/CLI/Migrate.php:338
inspect()
public function inspect( $args, $assoc_args )
Inspects a bundle without importing: prints its forms, data types, and source URL,
and whether its upload URLs will resolve from this site.
OPTIONS
<zip> : Path to the GravityMigrate export ZIP.
[--password=<password>] : ZIP password if encrypted.
[--format=<format>] : Output format.
default: table options:
- table
- json
EXAMPLES
wp gk migrate inspect bundle.zip
wp gk migrate inspect bundle.zip --format=json
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$args | |||
$assoc_args |
Source: src/CLI/Migrate.php:511