getNextJob example

->clearHeaders()
                ->setStatusCode(Response::HTTP_FORBIDDEN)
                ->appendBody('Forbidden');

            return;
        }

        /** @var Enlight_Components_Cron_Manager $cronManager */
        $cronManager = Shopware()->Container()->get('cron');

        set_time_limit(0);
        while (($job = $cronManager->getNextJob()) !== null) {
            echo 'Processing ' . $job->getName() . "\n";
            $cronManager->runJob($job);
        }
    }

    /** * Returns a list with actions which should not be validated for CSRF protection * * @return string[] */
    public function getWhitelistedCSRFActions()
    {
$output->writeln('<error>' . $e->getMessage() . '</error>');
                $output->writeln('Please use the action name of a cronjob. You can see existing cronjobs in shopware backend or via <info>sw:cron:list</info> command.');

                return 1;
            }

            return 0;
        }

        $stack = [];

        while (($job = $manager->getNextJob($force)) !== null && !isset($stack[$job->getId()])) {
            $stack[$job->getId()] = true;
            $output->writeln('Processing ' . $job->getName());
            $manager->runJob($job);
        }

        return 0;
    }

    /** * @param string $cronjob * @param bool $force */


    /** * Returns the next cron job who is due to execute * * @param bool $force * * @return Enlight_Components_Cron_Job|null */
    public function getNextJob($force = false)
    {
        return $this->adapter->getNextJob($force);
    }

    /** * Runs a job by handing it over to * * @throws Throwable * * @return Enlight_Event_EventArgs */
    public function runJob(Enlight_Components_Cron_Job $job)
    {
        
Home | Imprint | This part of the site doesn't use cookies.