Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Indexer.php
Go to the documentation of this file.
1 <?php
7 
10 
12 {
18  protected $reportDir;
19 
23  protected $filesystem;
24 
28  protected $_response;
29 
36  public function __construct(
37  $reportDir,
38  \Magento\Framework\Filesystem $filesystem,
39  \Magento\Indexer\Model\Processor $processor,
40  \Magento\Framework\App\Console\Response $response
41  ) {
42  $this->reportDir = $reportDir;
43  $this->filesystem = $filesystem;
44  $this->processor = $processor;
45  $this->_response = $response;
46  }
47 
53  public function launch()
54  {
55  /* Clean reports */
56  $directory = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
57  $path = $directory->getRelativePath($this->reportDir);
58  if ($directory->isExist($path)) {
59  $directory->delete($path);
60  }
61 
62  /* Regenerate all indexers */
63  $this->processor->reindexAll();
64  $this->_response->setCode(0);
65 
66  return $this->_response;
67  }
68 
72  public function catchException(App\Bootstrap $bootstrap, \Exception $exception)
73  {
74  return false;
75  }
76 }
$response
Definition: 404.php:11
$processor
Definition: 404.php:10
if(defined('TESTS_MAGENTO_INSTALLATION') &&TESTS_MAGENTO_INSTALLATION==='enabled') $bootstrap
Definition: bootstrap.php:73
__construct( $reportDir, \Magento\Framework\Filesystem $filesystem, \Magento\Indexer\Model\Processor $processor, \Magento\Framework\App\Console\Response $response)
Definition: Indexer.php:36
catchException(App\Bootstrap $bootstrap, \Exception $exception)
Definition: Indexer.php:72