/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $this->updateMemoryLimit(); $sampleDataPackages = $this->sampleDataDependency->getSampleDataPackages(); if (!empty($sampleDataPackages)) { $baseDir = $this->filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath(); $commonArgs = ['--working-dir' => $baseDir, '--no-progress' => 1]; $packages = []; foreach ($sampleDataPackages as $name => $version) { $packages[] = "{$name}:{$version}"; } $commonArgs = array_merge(['packages' => $packages], $commonArgs); $arguments = array_merge(['command' => 'require'], $commonArgs); /** @var ArrayInput $commandInput */ $commandInput = $this->arrayInputFactory->create(['parameters' => $arguments]); /** @var Application $application */ $application = $this->applicationFactory->create(); $application->setAutoExit(false); $result = $application->run($commandInput, $output); if ($result !== 0) { $output->writeln('<info>' . 'There is an error during sample data deployment.' . '</info>'); } } else { $output->writeln('<info>' . 'There is no sample data for current set of modules.' . '</info>'); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $sampleDataPackages = $this->sampleDataDependency->getSampleDataPackages(); if (!empty($sampleDataPackages)) { foreach (array_keys($sampleDataPackages) as $name) { $moduleName = $this->packageInfo->getModuleName($name); $this->moduleResource->setDataVersion($moduleName, ''); } $output->writeln('<info>' . 'Reset of sample data version completed successfully.' . '</info>'); } else { $output->writeln('<info>' . 'There is no sample data for current set of modules.' . '</info>'); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $sampleDataPackages = $this->sampleDataDependency->getSampleDataPackages(); if (!empty($sampleDataPackages)) { $baseDir = $this->filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath(); $commonArgs = ['--working-dir' => $baseDir, '--no-interaction' => 1, '--no-progress' => 1]; $packages = array_keys($sampleDataPackages); $arguments = array_merge(['command' => 'remove', 'packages' => $packages], $commonArgs); $commandInput = new ArrayInput($arguments); /** @var Application $application */ $application = $this->applicationFactory->create(); $application->setAutoExit(false); $result = $application->run($commandInput, $output); if ($result !== 0) { $output->writeln('<info>' . 'There is an error during remove sample data.' . '</info>'); } } else { $output->writeln('<info>' . 'There is no sample data for current set of modules.' . '</info>'); } }