2323
2424use Exception ;
2525use PrestaShop \Module \AutoUpgrade \Models \Module \Marketplace \ModuleUpgradeCompatibility ;
26- use PrestaShop \Module \AutoUpgrade \Parameters \UpgradeConfiguration ;
26+ use PrestaShop \Module \AutoUpgrade \Parameters \UpdateConfiguration ;
2727use PrestaShop \Module \AutoUpgrade \Parameters \UpgradeFileNames ;
2828use PrestaShop \Module \AutoUpgrade \Services \PhpVersionResolverService ;
2929use PrestaShop \Module \AutoUpgrade \Task \ExitCode ;
@@ -50,7 +50,7 @@ protected function configure(): void
5050 'channel ' ,
5151 null ,
5252 InputOption::VALUE_REQUIRED ,
53- "Select which update channel to use (' " . UpgradeConfiguration ::CHANNEL_LOCAL . "' / ' " . UpgradeConfiguration ::CHANNEL_ONLINE_RECOMMENDED . "' / ' " . UpgradeConfiguration ::CHANNEL_ONLINE . "') "
53+ "Select which update channel to use (' " . UpdateConfiguration ::CHANNEL_LOCAL . "' / ' " . UpdateConfiguration ::CHANNEL_ONLINE_RECOMMENDED . "' / ' " . UpdateConfiguration ::CHANNEL_ONLINE . "') "
5454 )
5555 ->addOption ('zip ' , null , InputOption::VALUE_REQUIRED , 'Sets the archive zip file for a local channel. ' )
5656 ->addOption ('xml ' , null , InputOption::VALUE_REQUIRED , 'Sets the archive xml file for a local update. ' )
@@ -69,9 +69,9 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
6969 $ this ->upgradeContainer ->getFileStorage ()->clean (UpgradeFileNames::UPDATE_CONFIG_FILENAME );
7070
7171 $ options = [
72- UpgradeConfiguration ::ARCHIVE_ZIP => 'zip ' ,
73- UpgradeConfiguration ::ARCHIVE_XML => 'xml ' ,
74- UpgradeConfiguration ::CHANNEL => 'channel ' ,
72+ UpdateConfiguration ::ARCHIVE_ZIP => 'zip ' ,
73+ UpdateConfiguration ::ARCHIVE_XML => 'xml ' ,
74+ UpdateConfiguration ::CHANNEL => 'channel ' ,
7575 ];
7676 foreach ($ options as $ configKey => $ optionName ) {
7777 $ optionValue = $ input ->getOption ($ optionName );
@@ -81,7 +81,8 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
8181 }
8282
8383 $ configPath = $ input ->getOption ('config-file-path ' );
84- $ exitCode = $ this ->loadConfiguration ($ configPath );
84+ $ loader = $ this ->upgradeContainer ->getUpdateConfigurationLoader ();
85+ $ exitCode = $ this ->loadConfiguration ($ loader , $ configPath );
8586 if ($ exitCode !== ExitCode::SUCCESS ) {
8687 return $ exitCode ;
8788 }
@@ -92,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
9293 $ config = $ this ->upgradeContainer ->getUpdateConfiguration ();
9394 $ channel = $ config ->getChannelOrDefault ();
9495
95- if ($ channel === UpgradeConfiguration ::CHANNEL_ONLINE_RECOMMENDED || $ channel === UpgradeConfiguration ::CHANNEL_ONLINE ) {
96+ if ($ channel === UpdateConfiguration ::CHANNEL_ONLINE_RECOMMENDED || $ channel === UpdateConfiguration ::CHANNEL_ONLINE ) {
9697 $ targetPsVersion = $ this ->upgradeContainer ->getUpgrader ()->getOnlineDestinationVersionForChannel ($ channel );
9798 } else {
9899 $ zip = $ config ->getChannelZip ();
@@ -146,6 +147,8 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
146147 } catch (Exception $ e ) {
147148 $ this ->logger ->error ("An error occurred during the check process: \n" . $ e );
148149 throw $ e ;
150+ } finally {
151+ $ this ->upgradeContainer ->getFileStorage ()->clean (UpgradeFileNames::UPDATE_CONFIG_FILENAME );
149152 }
150153 }
151154
0 commit comments