/** * Execute command * * @param InputInterface $input Input instance * @param OutputInterface $output Output instance * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { // #################### // Init // #################### $basePath = $this->getApplication()->getConfigValue('config', 'www_base_path', '/var/www/'); $maxDepth = 3; $output->writeln('<h2>Clear TYPO3 cache</h2>'); if ($input->getArgument('path')) { $basePath = $input->getArgument('path'); } // #################### // Find and loop through TYPO3 instances // #################### foreach (Typo3Utility::getTypo3InstancePathList($basePath, $maxDepth) as $dirPath) { // Check if coreapi is installed if (!is_dir($dirPath . '/typo3conf/ext/coreapi/')) { $output->writeln('<p>EXT:coreapi is missing on ' . $dirPath . ', skipping</p>'); continue; } $params = array($dirPath . '/typo3/cli_dispatch.phpsh', 'coreapi', 'cache:clearallcaches'); $output->writeln('<p>Running clearcache command on ' . $dirPath . '</p>'); try { $command = new CommandBuilder('php'); $command->setArgumentList($params)->executeInteractive(); } catch (\Exception $e) { $output->writeln('<p-error> Failed with exception: ' . $e->getMessage() . '</p-error>'); } } return 0; }
/** * Execute command * * @param InputInterface $input Input instance * @param OutputInterface $output Output instance * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { $paramList = $this->getFullParameterList(); $path = UnixUtility::findFileInDirectortyTree('Makefile'); if (!empty($path)) { $path = dirname($path); $this->output->writeln('<comment>Found Makefile directory: ' . $path . '</comment>'); // Switch to directory of docker-compose.yml PhpUtility::chdir($path); $command = new CommandBuilder('make'); if (!empty($paramList)) { $command->setArgumentList($paramList); } $command->executeInteractive(); } else { $this->output->writeln('<error>No Makefile found in tree</error>'); return 1; } return 0; }
/** * Execute command * * @param InputInterface $input Input instance * @param OutputInterface $output Output instance * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { $composerCmd = $this->getApplication()->getConfigValue('bin', 'composer'); $paramList = $this->getFullParameterList(); $composerJsonPath = UnixUtility::findFileInDirectortyTree('composer.json'); if (!empty($composerJsonPath)) { $path = dirname($composerJsonPath); $this->output->writeln('<comment>Found composer.json directory: ' . $path . '</comment>'); // Switch to directory of docker-compose.yml PhpUtility::chdir($path); $command = new CommandBuilder(); $command->parse($composerCmd); if (!empty($paramList)) { $command->setArgumentList($paramList); } $command->executeInteractive(); } else { $this->output->writeln('<error>No composer.json found in tree</error>'); return 1; } return 0; }