GravityKit\GravityMigrate\Background\JobNotices
A migration running in the background is invisible from every admin screen but the one that
started it, and once it finishes the export's download link lives only in a page state that completion deletes. A Foundation live notice follows the operator instead: progress wherever they are, and a link they can still reach afterwards.
Since: %ver%
Source: src/Background/JobNotices.php:23
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Background
Methods
| Method | Description |
|---|---|
get_instance() | Returns class instance. |
register() | Posts the progress notice for a job that has just been scheduled. |
dismiss() | Removes every notice this class posted for a migration, whatever job id they carry. |
complete() | Replaces a migration's progress notice with one carrying its outcome. |
live_update() | Answers a live-notice poll for a migration. |
Method Reference
get_instance()
public static function get_instance(): JobNotices
Returns class instance.
Returns
JobNotices
Since: %ver%
Source: src/Background/JobNotices.php:70
register()
public function register( string $migration, int $job_id ): void
Posts the progress notice for a job that has just been scheduled.
Slugged by job id rather than by clock, so re-registering for the same job replaces its notice instead of stacking a second one beside it.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$migration | string | One of \self::IMPORT(), \self::EXPORT(). | |
$job_id | int | Scheduler job id. |
Returns
void
Since: %ver%
Source: src/Background/JobNotices.php:91
dismiss()
public function dismiss( string $migration ): void
Removes every notice this class posted for a migration, whatever job id they carry.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$migration | string | One of \self::IMPORT(), \self::EXPORT(). |
Returns
void
Since: %ver%
Source: src/Background/JobNotices.php:136
complete()
public function complete( string $migration, array $summary ): void
Replaces a migration's progress notice with one carrying its outcome.
The export's download link is the reason this exists: \CleanupHandler deletes the
state the page would reattach to, so without a notice an operator who navigated away has
no route to the file they just waited for.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$migration | string | One of \self::IMPORT(), \self::EXPORT(). | |
$summary | array | The finished job's summary. |
Returns
void
Since: %ver%
Source: src/Background/JobNotices.php:211
live_update()
public function live_update( string $migration, $notice=null )
Answers a live-notice poll for a migration.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$migration | string | One of \self::IMPORT(), \self::EXPORT(). | |
$notice | mixed | null | The notice being refreshed, unused. |
Returns
array— Notice data. Carriesdisable_pollingonce no run owns the state: a falsy return reads to Foundation as a malformed callback response rather than as a run that has finished.
Since: %ver%
Source: src/Background/JobNotices.php:268