From 9a61df57c4c93ef8f2d18136d8dc7250d378d729 Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Fri, 29 Mar 2024 10:02:21 +0100 Subject: [PATCH 1/3] Make cache-warmup optional for initialize command --- api/src/Command/InitializationCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/Command/InitializationCommand.php b/api/src/Command/InitializationCommand.php index 71707915a..494875d82 100644 --- a/api/src/Command/InitializationCommand.php +++ b/api/src/Command/InitializationCommand.php @@ -69,6 +69,7 @@ protected function configure(): void ->addOption('skip-schema', 'sa', InputOption::VALUE_OPTIONAL, 'Don\'t update schema\'s during upgrade', false) ->addOption('skip-script', 'sp', InputOption::VALUE_OPTIONAL, 'Don\'t execute installation scripts during upgrade', false) ->addOption('unsafe', 'u', InputOption::VALUE_OPTIONAL, 'Delete data that is not present in the test data', false) + ->addOption('cache-warmup', 'c', InputOption::VALUE_OPTIONAL, 'Include running a cache:warmup at the end', false) // the short description shown while running "php bin/console list" ->setDescription('Facilitates the initialization of the gateway and checks configuration') @@ -89,6 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $config['skip-schema'] = $input->getOption('skip-schema'); $config['skip-script'] = $input->getOption('skip-script'); $config['unsafe'] = $input->getOption('unsafe'); + $config['cache-warmup'] = $input->getOption('cache-warmup'); // Throw the event $io->info('Throwing commongateway.pre.initialization event'); From 30431cedeb9349fa8179b743320739238ffbb66b Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Fri, 29 Mar 2024 15:47:17 +0100 Subject: [PATCH 2/3] Improve Initialize command --- api/docker/php/docker-entrypoint.sh | 2 +- api/src/Command/InitializationCommand.php | 28 ++++++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/api/docker/php/docker-entrypoint.sh b/api/docker/php/docker-entrypoint.sh index a7a99f934..d5045c5c6 100644 --- a/api/docker/php/docker-entrypoint.sh +++ b/api/docker/php/docker-entrypoint.sh @@ -52,7 +52,7 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then if [ "$APP_INIT" != 'false' ]; then echo "Initializing the gateway" - bin/console commongateway:initialize + bin/console commongateway:initialize --cache-warmup fi fi diff --git a/api/src/Command/InitializationCommand.php b/api/src/Command/InitializationCommand.php index 494875d82..1774b66ab 100644 --- a/api/src/Command/InitializationCommand.php +++ b/api/src/Command/InitializationCommand.php @@ -66,10 +66,11 @@ protected function configure(): void $this ->addOption('bundle', 'b', InputOption::VALUE_OPTIONAL, 'The bundle that you want to install (install only that bundle)') ->addOption('data', 'd', InputOption::VALUE_OPTIONAL, 'Load (example) data set(s) from the bundle', false) - ->addOption('skip-schema', 'sa', InputOption::VALUE_OPTIONAL, 'Don\'t update schema\'s during upgrade', false) - ->addOption('skip-script', 'sp', InputOption::VALUE_OPTIONAL, 'Don\'t execute installation scripts during upgrade', false) - ->addOption('unsafe', 'u', InputOption::VALUE_OPTIONAL, 'Delete data that is not present in the test data', false) + ->addOption('skip-schema', 's', InputOption::VALUE_OPTIONAL, 'Don\'t update schema\'s during upgrade', false) + ->addOption('skip-script', 'x', InputOption::VALUE_OPTIONAL, 'Don\'t execute installation scripts during upgrade', false) ->addOption('cache-warmup', 'c', InputOption::VALUE_OPTIONAL, 'Include running a cache:warmup at the end', false) + //todo? +// ->addOption('unsafe', 'u', InputOption::VALUE_OPTIONAL, 'Delete data that is not present in the test data', false) // the short description shown while running "php bin/console list" ->setDescription('Facilitates the initialization of the gateway and checks configuration') @@ -86,11 +87,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int $config = []; $config['bundle'] = $input->getOption('bundle'); - $config['data'] = $input->getOption('data'); - $config['skip-schema'] = $input->getOption('skip-schema'); - $config['skip-script'] = $input->getOption('skip-script'); - $config['unsafe'] = $input->getOption('unsafe'); - $config['cache-warmup'] = $input->getOption('cache-warmup'); + if ($input->getOption('data') !== false) { + $config['data'] = true; + } + if ($input->getOption('skip-schema') !== false) { + $config['skip-schema'] = true; + } + if ($input->getOption('skip-script') !== false) { + $config['skip-script'] = true; + } + if ($input->getOption('cache-warmup') !== false) { + $config['cache-warmup'] = true; + } +// if ($input->getOption('unsafe') !== false) { +// $config['unsafe'] = true; +// } // Throw the event $io->info('Throwing commongateway.pre.initialization event'); @@ -289,6 +300,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // In dev we also want to run the installer //if( getenv("APP_ENV") == "dev"){ $io->section('Running installer'); + echo json_encode($config); $this->installationService->update($config, $io); //} From 57c88c3c7d29b460e11db9ddb710c87217fd2b19 Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Fri, 29 Mar 2024 15:56:49 +0100 Subject: [PATCH 3/3] remove echo --- api/src/Command/InitializationCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/api/src/Command/InitializationCommand.php b/api/src/Command/InitializationCommand.php index 1774b66ab..decefe70e 100644 --- a/api/src/Command/InitializationCommand.php +++ b/api/src/Command/InitializationCommand.php @@ -300,7 +300,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int // In dev we also want to run the installer //if( getenv("APP_ENV") == "dev"){ $io->section('Running installer'); - echo json_encode($config); $this->installationService->update($config, $io); //}