reportDir = $reportDir; $this->filesystem = $filesystem; $this->processor = $processor; $this->_response = $response; } /** * Run application * * @return \Magento\Framework\App\ResponseInterface */ public function launch() { /* Clean reports */ $directory = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT); $path = $directory->getRelativePath($this->reportDir); if ($directory->isExist($path)) { $directory->delete($path); } /* Regenerate all indexers */ $this->processor->reindexAll(); $this->_response->setCode(0); return $this->_response; } /** * {@inheritdoc} */ public function catchException(App\Bootstrap $bootstrap, \Exception $exception) { return false; } }