Пример #1
0
 public function testCreateControllerNotExisting()
 {
     $context = TestHelper::getContext();
     $arcavias = TestHelper::getArcavias();
     $this->setExpectedException('Controller_Jobs_Exception');
     Controller_Jobs_Factory::createController($context, $arcavias, 'notexist');
 }
Пример #2
0
 /**
  * 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 = \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) {
             \Controller_Jobs_Factory::createController($context, $aimeos, $jobname)->run();
         }
     }
 }
Пример #3
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 = \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) {
             \Controller_Jobs_Factory::createController($context, $aimeos, $jobname)->run();
         }
     }
 }
Пример #4
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 = \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) {
             \Controller_Jobs_Factory::createController($context, $aimeos, $jobname)->run();
         }
     }
 }
Пример #5
0
 /**
  * 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) {
         \Controller_Jobs_Factory::createController($context, $aimeos, $name);
     }
     return true;
 }
Пример #6
0
 /**
  * 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)
  * - catalog/index/rebuild (rebuild the catalog index once a day after midnight)
  * - catalog/index/optimize (optimize the catalog index once a day one hour after the rebuild)
  * - customer/email/watch (send customers e-mails if their watched products have changed)
  * - 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 = \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));
             \Controller_Jobs_Factory::createController($context, $aimeos, $jobname)->run();
         }
     }
 }