![]() 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/magento/module-indexer/Controller/Adminhtml/Indexer/ |
<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Indexer\Controller\Adminhtml\Indexer; use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; /** * Controller endpoint for mass action: set index mode as 'Update on Save' */ class MassOnTheFly extends \Magento\Indexer\Controller\Adminhtml\Indexer implements HttpPostActionInterface { /** * Turn mview off for the given indexers * * @return void */ public function execute() { $indexerIds = $this->getRequest()->getParam('indexer_ids'); if (!is_array($indexerIds)) { $this->messageManager->addErrorMessage(__('Please select indexers.')); } else { try { foreach ($indexerIds as $indexerId) { /** @var \Magento\Framework\Indexer\IndexerInterface $model */ $model = $this->_objectManager->get( \Magento\Framework\Indexer\IndexerRegistry::class )->get($indexerId); $model->setScheduled(false); } $this->messageManager->addSuccess( __('%1 indexer(s) are in "Update on Save" mode.', count($indexerIds)) ); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( $e, __("We couldn't change indexer(s)' mode because of an error.") ); } } $this->_redirect('*/*/list'); } }