GravityKit\GravityMigrate\Abilities\MigrationRequest
Turns {platform, direction, forms} into a provider and the ids it recognises.
Shared by \Discovery\AnalyzeMigration and \Migration\RunMigration, which must
resolve a request identically: analyzing form 4 and then migrating form 4 has to mean the
same form.
Since: %ver%
Source: src/Abilities/MigrationRequest.php:25
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Abilities
Methods
| Method | Description |
|---|---|
input_properties() | The input properties both abilities publish. |
resolve() | The provider and the ids it recognises, or the refusal that stops the call. |
run() | Resolves the request, migrates its forms, and builds the response both abilities return. |
history_refusal() | Why skip_already_migrated cannot be honored for this provider, or null when it can. |
previous_form_id() | The form an earlier migration of this source form created, or null when there was none. |
Method Reference
input_properties()
public static function input_properties(): array
The input properties both abilities publish.
Returns
array
Since: %ver%
Source: src/Abilities/MigrationRequest.php:48
resolve()
public static function resolve( array $input, ?ExternalMigration $migration=null )
The provider and the ids it recognises, or the refusal that stops the call.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input | array | Input as received. | |
$migration | ExternalMigration | null | null | Reads the providers and their forms; this site's when null. |
Returns
array{provider:mixed,— form_ids:array, direction:string, skipped:array}|WP_Error
Since: %ver%
Source: src/Abilities/MigrationRequest.php:102
run()
public static function run( array $input, bool $dry_run )
Resolves the request, migrates its forms, and builds the response both abilities return.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input | array | Input as received. | |
$dry_run | bool | True to report what would happen without writing anything. |
Returns
array| WP_Error
Since: 2.1.1
Source: src/Abilities/MigrationRequest.php:216
history_refusal()
public static function history_refusal( string $direction, $provider ): ?WP_Error
Why skip_already_migrated cannot be honored for this provider, or null when it can.
Importers record their history through get_tracked_import_id(), which the importer
interface does not require. Running anyway would create the duplicates the caller asked to
avoid, with nothing reported as skipped.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$direction | string | \ExternalMigration::DIRECTION_TO() or \ExternalMigration::DIRECTION_FROM(). | |
$provider | mixed | The provider. |
Returns
- WP_Error |
null
Since: 2.1.1
Source: src/Abilities/MigrationRequest.php:272
previous_form_id()
public static function previous_form_id( string $direction, $provider, $form_id )
The form an earlier migration of this source form created, or null when there was none.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$direction | string | \ExternalMigration::DIRECTION_TO() or \ExternalMigration::DIRECTION_FROM(). | |
$provider | mixed | The provider. | |
$form_id | mixed | Source form id, in the source plugin's own terms. |
Returns
int|string|null
Since: 2.1.1
Source: src/Abilities/MigrationRequest.php:297