/** * @return array */ protected function _getProcessesForReindex() { if ($this->_indexes === null) { $this->_indexes = array(); $processes = $this->_indexer->getProcessesCollection()->addEventsStats(); /** @var $process \Magento\Index\Model\Process */ foreach ($processes as $process) { if (($process->getStatus() == \Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX || $process->getEvents() > 0) && $process->getIndexer()->isVisible()) { $this->_indexes[] = $process->getIndexer()->getName(); } } } return $this->_indexes; }
/** * Parses string with indexers and return array of indexer instances * * @param string $string * @return array */ protected function _parseIndexerString($string) { $processes = array(); if ($string == 'all') { $collection = $this->_indexer->getProcessesCollection(); foreach ($collection as $process) { $processes[] = $process; } } else { if (!empty($string)) { $codes = explode(',', $string); foreach ($codes as $code) { $process = $this->_indexer->getProcessByCode(trim($code)); if (!$process) { echo 'Warning: Unknown indexer with code ' . trim($code) . "\n"; $this->_hasErrors = true; } else { $processes[] = $process; } } } } return $processes; }