예제 #1
1
 /**
  * Returns the HTML code for the controller control.
  *
  * @param array $selected List of site codes that were previously selected by the user
  * @param string|null $filter String that must be part of the controller name
  * @return string HTML code with <option> tags for the select box
  */
 protected function getControllerOptions(array $selected, $filter = null)
 {
     $html = '';
     $aimeos = Base::getAimeos();
     $context = Scheduler\Base::getContext();
     $cntlPaths = $aimeos->getCustomPaths('controller/jobs');
     $langid = 'en';
     if (isset($GLOBALS['BE_USER']->uc['lang']) && $GLOBALS['BE_USER']->uc['lang'] != '') {
         $langid = $GLOBALS['BE_USER']->uc['lang'];
     }
     $localeItem = \MShop_Factory::createManager($context, 'locale')->createItem();
     $localeItem->setLanguageId($langid);
     $context->setLocale($localeItem);
     $controllers = \Controller_Jobs_Factory::getControllers($context, $aimeos, $cntlPaths);
     foreach ($controllers as $name => $controller) {
         if ($filter !== null && strstr($name, $filter) === false) {
             continue;
         }
         $active = in_array($name, $selected) ? 'selected="selected"' : '';
         $title = htmlspecialchars($controller->getDescription(), ENT_QUOTES, 'UTF-8');
         $cntl = htmlspecialchars($controller->getName(), ENT_QUOTES, 'UTF-8');
         $name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');
         $html .= sprintf('<option value="%1$s" title="%2$s" %3$s>%4$s</option>', $name, $title, $active, $cntl);
     }
     return $html;
 }
예제 #2
0
 public function testGetControllers()
 {
     $context = TestHelper::getContext();
     $arcavias = TestHelper::getArcavias();
     $list = Controller_Jobs_Factory::getControllers($context, $arcavias, TestHelper::getControllerPaths());
     $this->assertGreaterThan(0, count($list));
     foreach ($list as $key => $object) {
         $this->assertInstanceOf('Controller_Jobs_Interface', $object);
     }
 }
예제 #3
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();
         }
     }
 }
예제 #4
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();
         }
     }
 }
예제 #5
0
파일: Base.php 프로젝트: nos3/aimeos-typo3
 /**
  * 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();
         }
     }
 }
예제 #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();
         }
     }
 }