Skip to main content

GravityKit\GravityMigrate\Migration\MigrationStatus

The migration state, as facts rather than sentences.

wp gk migrate status renders this into a table and the abilities surface returns it as it is. The reading lives here so both answer "is an import running, is it stuck, is there anything left to clear" identically; the wording lives with each surface.

Since: %ver%

Source: src/Migration/MigrationStatus.php:24

Details

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

Methods

MethodDescription
current()The current state of every moving part, with no wording attached.
estimate_eta()Seconds remaining, estimated across the CURRENT PHASE only.
read_option()One option, read past every cache.

Method Reference

current()

public static function current(): array

The current state of every moving part, with no wording attached.

Returns

  • array{ — import_state:string, import_locked:bool, seconds_since_last_step:int|null, lock_timeout_seconds:int, progress:array|null, import_job_id:int|null, last_import:array, export_job_id:int|null, crashed_import:bool, pending_export:bool, is_clean:bool }

Since: %ver%

Source: src/Migration/MigrationStatus.php:69

estimate_eta()

public static function estimate_eta( $current, $total, $phase_started, $updated )

Seconds remaining, estimated across the CURRENT PHASE only.

The rate is current steps over the span since the phase began, projected across the steps left in it. The engine re-bases its counts between phases, so measuring against the whole run's elapsed time reports hours for work that takes minutes.

Null when no rate is derivable: no completed steps, no elapsed time, or a total the current count has outrun.

Parameters

NameTypeDefaultDescription
$currentintSteps completed so far in this phase.
$totalintTotal steps in this phase.
$phase_startedintUnix timestamp the current phase's counts started from.
$updatedintUnix timestamp of the record's last persist.

Returns

  • int | null

Since: %ver%

Source: src/Migration/MigrationStatus.php:208

read_option()

public static function read_option( $option_name )

One option, read past every cache.

Straight SQL rather than get_option(): a long-lived CLI process and a REST request both hold an options cache from the moment they started, so a cached read answers with the state as it was when the reader booted, not as it is now.

Parameters

NameTypeDefaultDescription
$option_namestringOption name.

Returns

  • mixed — False when the option does not exist.

Since: %ver%

Source: src/Migration/MigrationStatus.php:231