Skip to main content

GravityKit\GravityMigrate\Background\ImportedForms

Records which forms a run created, so the screen that says it finished can name them.

Without it the completion summary carries a step label, a progress count and the data types covered -- everything about the run except the thing the run produced, leaving whoever just migrated twenty forms to go and find them.

Recorded through an option rather than threaded along the payload: the import's final step returns only its progress flags, so anything travelling that way is dropped at the last boundary, and a run resumes across requests where an in-memory list would not survive.

Since: %ver%

Source: src/Background/ImportedForms.php:27

Details

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Background

Methods

MethodDescription
record()Adds the ids a step created to the run's list.
ids()The ids recorded so far.
file_audit()How many of the imported forms' files are on this site, and how many are not.
summary()The forms a completion screen can list, each with somewhere to go.
clear()Clears the list.

Method Reference

record()

public static function record( array $form_ids ): void

Adds the ids a step created to the run's list.

Parameters

NameTypeDefaultDescription
$form_idsint[]Gravity Forms form ids.

Returns

  • void

Since: %ver%

Source: src/Background/ImportedForms.php:38

ids()

public static function ids(): array

The ids recorded so far.

Returns

  • int[]

Since: %ver%

Source: src/Background/ImportedForms.php:57

file_audit()

public static function file_audit(): array

How many of the imported forms' files are on this site, and how many are not.

A file that did not come across leaves the source site's URL on the entry. That URL keeps working while the source is up, so nothing errors and nothing is logged above debug -- the import looks complete right until the source goes away, which for most migrations is days. Counting is the only way to notice, so the count travels with the completion summary and the screen says it.

Returns

  • array{here:int,elsewhere:int,total:int}

Since: %ver%

Source: src/Background/ImportedForms.php:76

summary()

public static function summary( ?array $ids=null ): array

The forms a completion screen can list, each with somewhere to go.

A form is named from Gravity Forms rather than from the bundle, because the importer gives a clashing title a unique one on the way in (GFAPI::unique_title) -- so the bundle's title is not what the operator will see in the list they are being sent to.

Parameters

NameTypeDefaultDescription
$idsarray | nullnullForm ids to describe. Null reads the run list, which only answers while that list is still the current run's.

Returns

  • array<int, — array{id: int, title: string, edit_url: string}>

Since: %ver%

Source: src/Background/ImportedForms.php:113

clear()

public static function clear(): void

Clears the list.

Called when a run starts, so a completion screen never lists forms from the run before it.

Returns

  • void

Since: %ver%

Source: src/Background/ImportedForms.php:152