Search by

prestashopheaven / runtime-cron

georgevanengers

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.

Package info

github.com/prestashopheaven/runtime-cron

pkg:composer/prestashopheaven/runtime-cron

Statistics

Installs: 2 127

Dependents: 0

Suggesters: 0

Stars: 0

v1.2.1 2026-12-02 02:30 UTC

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.