/** * {@inheritdoc} */ public function scheduleNext(SchedulerInterface $scheduler) { $now = new \DateTime(); $executionDate = $now->modify('+1 day'); if (null !== $this->end && $executionDate > $this->end) { return; } $scheduler->createTask($this->getTaskName(), $this->getWorkload())->daily($this->start, $this->end)->setExecutionDate($executionDate)->schedule(); }
public function testRun() { $this->storage->clear(); $this->scheduler->schedule(new Task('test', 'workload')); $this->scheduler->run(); $scheduled = $this->storage->findScheduled(); $this->assertCount(0, $scheduled); $all = $this->storage->findAll(); $this->assertCount(1, $all); $this->assertEquals('test', $all[0]->getTaskName()); $this->assertEquals('workload', $all[0]->getWorkload()); $this->assertTrue($all[0]->isCompleted()); $this->assertEquals('daolkrow', $all[0]->getResult()); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $this->scheduler->run(); }
/** * Called by event: ContentEvents::NODE_POST_SAVE */ public function onSave(ContentNodeEvent $event) { $this->scheduler->createTask('sulu_task.warmup_page', ['uuid' => $event->getNode()->getIdentifier(), 'locale' => $event->getStructure()->getLanguageCode(), 'webspaceKey' => $event->getStructure()->getWebspaceKey()])->schedule(); }
/** * Run scheduled tasks. * * @param Event $event */ public function run(Event $event) { $this->scheduler->run(); }
/** * {@inheritdoc} */ public function schedule() { $this->scheduler->schedule($this->task); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $this->scheduler->createTask($input->getArgument('handler'), $input->getArgument('workload'))->schedule(); }