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 b6ceb89
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/register_cron_aliases.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<?php

use Cron\CronExpression;
namespace ipl\Scheduler {
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 *');
}

spl_autoload_unregister($loader);
};

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

0 comments on commit b6ceb89

Please sign in to comment.