prestashopheaven / runtime-cron
The cron URL of a PrestaHaven module: a JSON front controller that checks the module's token (never an empty one), runs the job for the shop of the URL and never shows error details.
Requires
- php: >=8.1
- prestashopheaven/runtime-cqrs: ^1.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-02 17:04:04 UTC
README
The cron URL of a PrestaHaven module: a JSON front controller that checks the module's token (never an empty one), runs the job for the shop of the URL and never shows error details.
Use when
A module offers a cron URL (index.php?fc=module&module=&controller=cron&cron_token=…) per shop for a periodic job, or needs to compare a secret token safely.
Install
composer require prestashopheaven/runtime-cron
Usage
Keep two runs of the same job apart (a cron URL called twice, the cron URL and the console at once):
use PrestaShopHeaven\Runtime\Cron\CronLock; $lock = new CronLock('heavenexample', 'process'); if (!$lock->acquire()) { return; // another run is busy } try { // ... the job } finally { $lock->release(); }
The lock is a named database lock (GET_LOCK): the database frees it when a process dies, so it never stays stale.
Compare a token with CronToken::matches($expected, Tools::getValue('cron_token')); an empty expected token never
matches.
Read-only split of prestashopheaven/mono-runtime-integration: changes,
issues and pull requests go there. MIT License.