Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigStatusCommand.php
Go to the documentation of this file.
1 <?php
7 
10 use Symfony\Component\Console\Command\Command;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 
17 class ConfigStatusCommand extends Command
18 {
23 
27  private $changeDetector;
28 
33  public function __construct(ChangeDetector $changeDetector)
34  {
35  $this->changeDetector = $changeDetector;
36  parent::__construct();
37  }
38 
42  protected function configure()
43  {
44  $this->setName('app:config:status')
45  ->setDescription('Checks if config propagation requires update');
46  parent::configure();
47  }
48 
52  protected function execute(InputInterface $input, OutputInterface $output)
53  {
54  if ($this->changeDetector->hasChanges()) {
55  $output->writeln(
56  '<info>Config files have changed. ' .
57  'Run app:config:import or setup:upgrade command to synchronize configuration.</info>'
58  );
60  }
61  $output->writeln('<info>Config files are up to date.</info>');
62  return Cli::RETURN_SUCCESS;
63  }
64 }
execute(InputInterface $input, OutputInterface $output)