CoolCMS API

ProductImportRunTrait

Starts an import from the admin `edit` page.

"Run" queues the job (cron picks it up within a minute); "Run now" runs it synchronously in the request (up to ProductImportManager::RUN_NOW_MAX_ITEMS items) under the same lock as the cron Cron:Eshop:ProductImport:run, so a manual run and the cron never overlap. The lock is a UI-level protection and lives here, not in the manager.

The status action shows a progress bar, counts and the last errors; Naja polling (handleRefreshStatus()) redraws the importStatus snippet and the JS (behaviors/poll.js, attribute data-poll-url) stops after done/failed.

Table of Contents

Constants

STATUS_POLL_INTERVAL  : int = 3000
Status polling interval in ms.

Properties

$cronLockManager  : CronLockManager
$runStatus  : array<string, mixed>|null
Polling data from the Api bridge (`getRunStatus`).

Methods

actionStatus()  : void
handleEnqueue()  : void
Queues the job; the cron `/cron/eshop/product-import/run` picks it up within a minute.
handleRefreshStatus()  : void
Polls `status` and redraws only the progress snippet.
handleRunNow()  : void
Runs the job synchronously under the cron lock, then redirects to `status`.
renderStatus()  : void
canRunNow()  : bool
loadRunStatus()  : array<string, mixed>|null
prepareRunStatus()  : void

Constants

Properties

$runStatus

Polling data from the Api bridge (`getRunStatus`).

private array<string, mixed>|null $runStatus = null

Methods

handleEnqueue()

Queues the job; the cron `/cron/eshop/product-import/run` picks it up within a minute.

public handleEnqueue(int $id) : void
Parameters
$id : int
Attributes
#[Requires]
$methods: 'POST'

handleRefreshStatus()

Polls `status` and redraws only the progress snippet.

public handleRefreshStatus(int $id) : void
Parameters
$id : int

handleRunNow()

Runs the job synchronously under the cron lock, then redirects to `status`.

public handleRunNow(int $id) : void
Parameters
$id : int
Attributes
#[Requires]
$methods: 'POST'

loadRunStatus()

private loadRunStatus(int $id) : array<string, mixed>|null
Parameters
$id : int
Return values
array<string, mixed>|null
On this page

Search results