public function testCreateControllerNotExisting()
 {
     $context = \TestHelper::getContext();
     $aimeos = \TestHelper::getAimeos();
     $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
     \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, 'notexist');
 }
Beispiel #2
0
 /**
  * Executes the job controllers.
  *
  * @param InputInterface $input Input object
  * @param OutputInterface $output Output object
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $context = $this->getContext();
     $aimeos = $this->getContainer()->get('aimeos')->get();
     $jobs = explode(' ', $input->getArgument('jobs'));
     $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
     foreach ($this->getSiteItems($context, $input) as $siteItem) {
         $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false);
         $context->setLocale($localeItem);
         $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode()));
         foreach ($jobs as $jobname) {
             \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run();
         }
     }
 }
Beispiel #3
0
 /**
  * Execute the list of jobs for the given sites
  *
  * @param array $conf Multi-dimensional array of configuration options
  * @param array $jobs List of job names
  * @param string $sites List of site names
  */
 public static function execute(array $conf, array $jobs, $sites)
 {
     $aimeos = Aimeos\Base::getAimeos();
     $context = self::getContext($conf);
     $manager = \Aimeos\MShop\Factory::createManager($context, 'locale');
     foreach (self::getSiteItems($context, $sites) as $siteItem) {
         $localeItem = $manager->bootstrap($siteItem->getCode(), '', '', false);
         $localeItem->setLanguageId(null);
         $localeItem->setCurrencyId(null);
         $context->setLocale($localeItem);
         foreach ($jobs as $jobname) {
             \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run();
         }
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $aimeos = $this->getLaravel()->make('\\Aimeos\\Shop\\Base\\Aimeos')->get();
     $context = $this->getContext();
     $jobs = explode(' ', $this->argument('jobs'));
     $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
     foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) {
         $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false);
         $context->setLocale($localeItem);
         $this->info(sprintf('Executing the Aimeos jobs for "%s"', $siteItem->getCode()));
         foreach ($jobs as $jobname) {
             \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run();
         }
     }
 }
Beispiel #5
0
 /**
  * Removes the cached data for the given sites
  *
  * @param \Aimeos\Bootstrap $aimeos Aimeos bootstrap object
  * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object
  * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface
  */
 protected static function execute(\Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs)
 {
     $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
     foreach ($siteItems as $siteItem) {
         $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false);
         $localeItem->setLanguageId(null);
         $localeItem->setCurrencyId(null);
         $ctx->setLocale($localeItem);
         printf("Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode());
         foreach ((array) explode(' ', $jobs) as $jobname) {
             \Aimeos\Controller\Jobs\Factory::createController($ctx, $aimeos, $jobname)->run();
         }
     }
 }
 /**
  * Executes the Aimeos maintenance jobs
  *
  * The Aimeos shop system needs some maintenance tasks that must be
  * regularly executed. These include
  *
  * - admin/cache (remove expired cache entries once a day)
  * - admin/job (process import/export jobs created in the admin interface every five minutes)
  * - admin/log (archivate and delete old log entries once a day)
  * - customer/email/watch (send customers e-mails if their watched products have changed)
  * - index/rebuild (rebuild the catalog index once a day after midnight)
  * - index/optimize (optimize the catalog index once a day one hour after the rebuild)
  * - order/cleanup/unfinished (remove unfinised orders once a day)
  * - order/cleanup/unfinised (remove unpaid orders once a day)
  * - order/email/delivery (send delivery status update e-mails to the customers every few hours)
  * - order/email/payment (send payment status update e-mails to the customers every few hours)
  * - order/service/async (import batch delivery or payment status updates if necessary)
  * - order/service/delivery (sends paid orders to the ERP system or logistic partner)
  * - order/service/payment (captures authorized payments after the configured amount of time automatically)
  * - product/bought (updates the suggested products based on what other customers bought once a day)
  * - product/export (export products)
  * - product/export/sitemap (generate product sitemaps for search engines)
  * - product/import/csv (import products from CSV files)
  *
  * Each of these maintenance tasks must be executed for all shop instances
  * if you have more than one site in your installation. The sites parameter
  * should contain a list of site codes in this case. If you only have one
  * site named "default" then you don't need to specify the site.
  *
  * @param string $jobs List of job names separated by a space character like "admin/job catalog/index/rebuild"
  * @param string $sites List of sites separated by a space character the jobs should be executed for, e.g. "default unittest"
  * @return void
  */
 public function jobsCommand($jobs, $sites = 'default')
 {
     $aimeos = $this->objectManager->get('\\Aimeos\\Shop\\Base\\Aimeos')->get();
     $context = $this->getContext();
     $jobs = explode(' ', $jobs);
     $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
     foreach ($this->getSiteItems($context, $sites) as $siteItem) {
         $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
         $localeItem->setLanguageId(null);
         $localeItem->setCurrencyId(null);
         $context->setLocale($localeItem);
         $this->outputFormatted('Executing jobs for site <b>%s</b>', array($siteItem->getCode()));
         foreach ($jobs as $jobname) {
             $this->outputFormatted('  <b>%s</b>', array($jobname));
             \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run();
         }
     }
 }
 /**
  * Fields validation.
  * This method checks if page id given in the 'Hide content' specific task is int+
  * If the task class is not relevant, the method is expected to return true
  *
  * @param array $submittedData Reference to the array containing the data submitted by the user
  * @param tx_scheduler_Module $parentObject Reference to the calling object (Scheduler's BE module)
  * @return boolean True if validation was ok (or selected class is not relevant), false otherwise
  */
 protected function validateFields(array &$submittedData, $parentObject)
 {
     if (count((array) $submittedData[$this->fieldController]) < 1) {
         throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/Scheduler.xml:default.error.controller.missing'));
     }
     if (count((array) $submittedData[$this->fieldSite]) < 1) {
         throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/Scheduler.xml:default.error.sitecode.missing'));
     }
     Base::parseTS($submittedData[$this->fieldTSconfig]);
     $context = Scheduler\Base::getContext();
     $siteItems = Scheduler\Base::getSiteItems($context, $submittedData[$this->fieldSite]);
     if (count($siteItems) !== count($submittedData[$this->fieldSite])) {
         throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/Scheduler.xml:default.error.sitecode'));
     }
     $aimeos = Base::getAimeos();
     $cntlPaths = $aimeos->getCustomPaths('controller/jobs');
     foreach ((array) $submittedData[$this->fieldController] as $name) {
         \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $name);
     }
     return true;
 }