![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/mageworx/module-xmlsitemap/Console/Command/ |
<?php /** * Copyright © MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\XmlSitemap\Console\Command; use Magento\Framework\Exception\LocalizedException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class XmlSitemapGenerateCommand extends AbstractSitemapManageCommand { /** * {@inheritdoc} */ protected function configure() { $this->setName('xmlsitemap:generate'); $this->setDescription( 'Generate the XML sitemap with specified IDs(separate IDs by space).' . ' The IDs can be found in the XML sitemap grid.' ); parent::configure(); } /** * * @return boolean */ protected function isEnable() { return true; } /** * Dispatch event * * @param array $sitemapIds * @return void */ protected function performAction(array $sitemapIds) { $this->eventManager->dispatch( 'mageworx_xmlsitemap_sitemap_generate', [ 'sitemapIds' => $sitemapIds ] ); } /** * {@inheritdoc} */ protected function getDisplayMessage() { return 'Generated sitemap ids:'; } /** * Retrieve finish notice * * @return string */ protected function getSuccessMessage() { return 'Generation has been finished successfully.'; } /** * Perform cache management action * * @param InputInterface $input * @param OutputInterface $output * @return int * @throws LocalizedException */ protected function execute(InputInterface $input, OutputInterface $output) { $ids = $this->getRequestedIds($input); if (empty($input->getArgument("ids"))) { $output->writeln($this->getDisplayMessage()); $output->writeln($this->getColumnsValues()); } else { $this->performAction($ids); $output->writeln($this->getSuccessMessage()); } return 0; } }