GravityKit\GravityMigrate\Background\ExportJobDriver
Continues a Gravity Forms export across Foundation scheduler task executions.
begin_export() already ran synchronously in the request that scheduled the job (see
BackgroundController), so every slice this driver runs is a continue_export() step: the
same export AJAX route closure the browser posts to and CLI\Migrate::drive_export()
loops, called here with [ 'status' => 1 ] in place of a browser round-trip. The export's own
state machine lives entirely in Export and Options::EXPORT_RECORD; this class only drives
it one cooperative slice per task execution, mirroring lightweight progress into
Options::BG_EXPORT_STATE between slices so the status routes have something to read without
touching EXPORT_RECORD (which still carries the export password).
Since: %ver%
Source: src/Background/ExportJobDriver.php:30
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Background
Properties
| Property | Type | Description |
|---|---|---|
$gateway_override | object | null | Test seam: overrides the scheduler gateway run() resolves against. |
$step_runner_override | callable | null | Test seam: overrides the step runner run() loops instead of resolving it from the |
Methods
| Method | Description |
|---|---|
set_gateway_for_testing() | Sets the scheduler gateway a test wants run() to use. |
set_step_runner_for_testing() | Sets the step runner a test wants run() to loop instead of the real export route. |
run() | Runs one cooperative slice of a background export. |
Method Reference
set_gateway_for_testing()
public static function set_gateway_for_testing( $gateway ): void
Sets the scheduler gateway a test wants run() to use.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$gateway | object | null | Scripted gateway double, or null to clear the override. |
Returns
void
Since: %ver%
Source: src/Background/ExportJobDriver.php:64
set_step_runner_for_testing()
public static function set_step_runner_for_testing( ?callable $step_runner ): void
Sets the step runner a test wants run() to loop instead of the real export route.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$step_runner | callable | null | Scripted step runner, or null to clear the override. |
Returns
void
Since: %ver%
Source: src/Background/ExportJobDriver.php:77
run()
public static function run( array $args=[], $job_data=null )
Runs one cooperative slice of a background export.
Reads the export's persisted progress mirror, impersonates the user who scheduled the
job, and loops the export's continue_export() step until the archive is packaged, the
scheduler's time budget for this task execution runs out, or a step throws.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$args | array | [] | Task args. Read for should_continue()'s deadline. |
$job_data | array | null | null | Shared job data. Must carry the scheduling job_id. |
Returns
mixed— The gateway's checkpoint/completion result.
Throws
Exception— When the persisted state cannot be resumed against this job.Throwable— When a step throws; rethrown after the state is marked failed.
Since: %ver%
Source: src/Background/ExportJobDriver.php:98