/** * Schedule array of jobs from now until $endTime * @param type $jobs * @param \DateTime $endTime */ public function scheduleJobs($endTime = null) { $jobs = Cron::getPotentialJobs(); $startTime = new \DateTime(); if ($endTime === null) { $endTime = new \DateTime("+15 minutes"); } while ($startTime != $endTime) { $startTime->modify('+1 minute'); foreach ($jobs as $job) { $this->_scheduleJob($job, $startTime); } } }
<?php use Virge\Cron; use Virge\Cron\Command\CleanupCommand; use Virge\Cron\Command\ScheduleCommand; /** * * @author Michael Kramer */ Cron::add('cron/cleanup', CleanupCommand::COMMAND, array(), '*/15 * * * *'); Cron::add('cron/schedule', ScheduleCommand::COMMAND, array(), '*/15 * * * *');