Skip to content

Commit

Permalink
register_cron_aliases.php: Register cron aliases lazily
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Oct 26, 2023
1 parent 6119afd commit e0e9ab8
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/register_cron_aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

use Cron\CronExpression;

if (! CronExpression::supportsAlias('@minutely')) {
CronExpression::registerAlias('@minutely', '* * * * *');
}
$loader = function () use (&$loader) {
if (! CronExpression::supportsAlias('@minutely')) {
CronExpression::registerAlias('@minutely', '* * * * *');
}

if (! CronExpression::supportsAlias('@quarterly')) {
CronExpression::registerAlias('@quarterly', '0 0 1 */3 *');
}
if (! CronExpression::supportsAlias('@quarterly')) {
CronExpression::registerAlias('@quarterly', '0 0 1 */3 *');
}

spl_autoload_unregister($loader);
unset($loader);
};

spl_autoload_register($loader, true, true);

0 comments on commit e0e9ab8

Please sign in to comment.