Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProfilerDisableCommand.php
Go to the documentation of this file.
1 <?php
8 
10 use Symfony\Component\Console\Command\Command;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 
14 class ProfilerDisableCommand extends Command
15 {
19  const PROFILER_FLAG_FILE = 'var/profiler.flag';
20 
24  const COMMAND_NAME = 'dev:profiler:disable';
25 
29  const SUCCESS_MESSAGE = 'Profiler disabled.';
30 
34  private $filesystem;
35 
42  public function __construct(File $filesystem)
43  {
44  parent::__construct();
45  $this->filesystem = $filesystem;
46  }
47 
51  protected function configure()
52  {
53  $this->setName(self::COMMAND_NAME)
54  ->setDescription('Disable the profiler.');
55 
56  parent::configure();
57  }
58 
63  protected function execute(InputInterface $input, OutputInterface $output)
64  {
65  $this->filesystem->rm(BP . '/' . self::PROFILER_FLAG_FILE);
66  if (!$this->filesystem->fileExists(BP . '/' . self::PROFILER_FLAG_FILE)) {
67  $output->writeln('<info>'. self::SUCCESS_MESSAGE . '</info>');
68  return;
69  }
70  $output->writeln('<error>Something went wrong while disabling the profiler.</error>');
71  }
72 }
const BP
Definition: autoload.php:14
execute(InputInterface $input, OutputInterface $output)
$filesystem