88namespace Magento \CloudPatches \Command ;
99
1010use Magento \CloudPatches \App \RuntimeException ;
11- use Magento \CloudPatches \Command \Process \ApplyLocal ;
1211use Magento \CloudPatches \Command \Process \ApplyOptional ;
13- use Magento \CloudPatches \Command \Process \ApplyRequired ;
1412use Magento \CloudPatches \Composer \MagentoVersion ;
15- use Magento \CloudPatches \Patch \Environment ;
1613use Psr \Log \LoggerInterface ;
1714use Symfony \Component \Console \Input \InputArgument ;
1815use Symfony \Component \Console \Input \InputInterface ;
19- use Symfony \Component \Console \Input \InputOption ;
2016use Symfony \Component \Console \Output \OutputInterface ;
2117
2218/**
23- * Patch apply command.
19+ * Patch apply command (OnPrem) .
2420 */
2521class Apply extends AbstractCommand
2622{
@@ -30,35 +26,15 @@ class Apply extends AbstractCommand
3026 const NAME = 'apply ' ;
3127
3228 /**
33- * Defines whether Magento is installed from Git .
29+ * List of patches to apply .
3430 */
35- const OPT_GIT_INSTALLATION = 'git-installation ' ;
36-
37- /**
38- * List of quality patches to apply.
39- */
40- const ARG_QUALITY_PATCHES = 'quality-patches ' ;
31+ const ARG_LIST_OF_PATCHES = 'list-of-patches ' ;
4132
4233 /**
4334 * @var ApplyOptional
4435 */
4536 private $ applyOptional ;
4637
47- /**
48- * @var ApplyRequired
49- */
50- private $ applyRequired ;
51-
52- /**
53- * @var ApplyLocal
54- */
55- private $ applyLocal ;
56-
57- /**
58- * @var Environment
59- */
60- private $ environment ;
61-
6238 /**
6339 * @var LoggerInterface
6440 */
@@ -70,25 +46,16 @@ class Apply extends AbstractCommand
7046 private $ magentoVersion ;
7147
7248 /**
73- * @param ApplyRequired $applyRequired
7449 * @param ApplyOptional $applyOptional
75- * @param ApplyLocal $applyLocal
76- * @param Environment $environment
7750 * @param LoggerInterface $logger
7851 * @param MagentoVersion $magentoVersion
7952 */
8053 public function __construct (
81- ApplyRequired $ applyRequired ,
8254 ApplyOptional $ applyOptional ,
83- ApplyLocal $ applyLocal ,
84- Environment $ environment ,
8555 LoggerInterface $ logger ,
8656 MagentoVersion $ magentoVersion
8757 ) {
88- $ this ->applyRequired = $ applyRequired ;
8958 $ this ->applyOptional = $ applyOptional ;
90- $ this ->applyLocal = $ applyLocal ;
91- $ this ->environment = $ environment ;
9259 $ this ->logger = $ logger ;
9360 $ this ->magentoVersion = $ magentoVersion ;
9461
@@ -101,17 +68,11 @@ public function __construct(
10168 protected function configure ()
10269 {
10370 $ this ->setName (self ::NAME )
104- ->setDescription ('Apply patches ' )
71+ ->setDescription ('Applies patches. The list of patches should pass as a command argument ' )
10572 ->addArgument (
106- self ::ARG_QUALITY_PATCHES ,
107- InputArgument::IS_ARRAY ,
108- 'List of quality patches to apply '
109- )->addOption (
110- self ::OPT_GIT_INSTALLATION ,
111- null ,
112- InputOption::VALUE_OPTIONAL ,
113- 'Is git installation ' ,
114- false
73+ self ::ARG_LIST_OF_PATCHES ,
74+ InputArgument::IS_ARRAY | InputArgument::REQUIRED ,
75+ 'List of patches to apply '
11576 );
11677
11778 parent ::configure ();
@@ -122,23 +83,10 @@ protected function configure()
12283 */
12384 public function execute (InputInterface $ input , OutputInterface $ output )
12485 {
125- $ deployedFromGit = $ input ->getOption (Apply::OPT_GIT_INSTALLATION );
126- if ($ deployedFromGit ) {
127- $ output ->writeln ('<info>Git-based installation. Skipping patches applying.</info> ' );
128-
129- return self ::RETURN_SUCCESS ;
130- }
131-
13286 $ this ->logger ->notice ($ this ->magentoVersion ->get ());
13387
13488 try {
135- if ($ this ->environment ->isCloud ()) {
136- $ this ->applyRequired ->run ($ input , $ output );
137- $ this ->applyOptional ->run ($ input , $ output );
138- $ this ->applyLocal ->run ($ input , $ output );
139- } else {
140- $ this ->applyOptional ->run ($ input , $ output );
141- }
89+ $ this ->applyOptional ->run ($ input , $ output );
14290 } catch (RuntimeException $ e ) {
14391 $ output ->writeln ('<error> ' . $ e ->getMessage () . '</error> ' );
14492 $ this ->logger ->error ($ e ->getMessage ());
0 commit comments