Skip to content

Commit edb6678

Browse files
author
Yevhen Miroshnychenko
authored
MAGECLOUD-2509: Command bin/magento doesn't work if Magento uninstalled (#347)
* MAGECLOUD-2509: Command bin/magento doesn't work if magento uninstalled
1 parent 94d054e commit edb6678

3 files changed

+118
-0
lines changed

patches.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@
127127
},
128128
"The recursion detected error during deployment": {
129129
"2.2.0 - 2.2.6": "MAGECLOUD-2173__the_recursion_error_during_deployment__2.2.0.patch"
130+
},
131+
"Remove the permission check for the console application": {
132+
"2.2.0 - 2.2.5": "MAGECLOUD-2509__remove_permission_check_for_console_application__2.2.0.patch",
133+
"2.2.6": "MAGECLOUD-2509__remove_permission_check_for_console_application__2.2.6.patch"
130134
}
131135
}
132136
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
diff -Naur a/vendor/magento/framework/Console/Cli.php b/vendor/magento/framework/Console/Cli.php
2+
--- a/vendor/magento/framework/Console/Cli.php
3+
+++ b/vendor/magento/framework/Console/Cli.php
4+
@@ -9,7 +9,6 @@ use Magento\Framework\App\Bootstrap;
5+
use Magento\Framework\App\DeploymentConfig;
6+
use Magento\Framework\App\Filesystem\DirectoryList;
7+
use Magento\Framework\App\ProductMetadata;
8+
-use Magento\Framework\App\State;
9+
use Magento\Framework\Composer\ComposerJsonFinder;
10+
use Magento\Framework\Console\Exception\GenerationDirectoryAccessException;
11+
use Magento\Framework\Filesystem\Driver\File;
12+
@@ -19,7 +18,6 @@ use Magento\Setup\Application;
13+
use Magento\Setup\Console\CompilerPreparation;
14+
use Magento\Setup\Model\ObjectManagerProvider;
15+
use Symfony\Component\Console;
16+
-use Zend\ServiceManager\ServiceManager;
17+
18+
/**
19+
* Magento 2 CLI Application.
20+
@@ -74,7 +72,6 @@ class Cli extends Console\Application
21+
22+
$this->assertCompilerPreparation();
23+
$this->initObjectManager();
24+
- $this->assertGenerationPermissions();
25+
} catch (\Exception $exception) {
26+
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
27+
$output->writeln(
28+
@@ -166,33 +163,6 @@ class Cli extends Console\Application
29+
$omProvider->setObjectManager($this->objectManager);
30+
}
31+
32+
- /**
33+
- * Checks whether generation directory is read-only.
34+
- * Depends on the current mode:
35+
- * production - application will proceed
36+
- * default - application will be terminated
37+
- * developer - application will be terminated
38+
- *
39+
- * @return void
40+
- * @throws GenerationDirectoryAccessException If generation directory is read-only in developer mode
41+
- */
42+
- private function assertGenerationPermissions()
43+
- {
44+
- /** @var GenerationDirectoryAccess $generationDirectoryAccess */
45+
- $generationDirectoryAccess = $this->objectManager->create(
46+
- GenerationDirectoryAccess::class,
47+
- ['serviceManager' => $this->serviceManager]
48+
- );
49+
- /** @var State $state */
50+
- $state = $this->objectManager->get(State::class);
51+
-
52+
- if ($state->getMode() !== State::MODE_PRODUCTION
53+
- && !$generationDirectoryAccess->check()
54+
- ) {
55+
- throw new GenerationDirectoryAccessException();
56+
- }
57+
- }
58+
-
59+
/**
60+
* Checks whether compiler is being prepared.
61+
*
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
diff -Naur a/vendor/magento/framework/Console/Cli.php b/vendor/magento/framework/Console/Cli.php
2+
--- a/vendor/magento/framework/Console/Cli.php
3+
+++ b/vendor/magento/framework/Console/Cli.php
4+
@@ -9,7 +9,6 @@ use Magento\Framework\App\Bootstrap;
5+
use Magento\Framework\App\DeploymentConfig;
6+
use Magento\Framework\App\Filesystem\DirectoryList;
7+
use Magento\Framework\App\ProductMetadata;
8+
-use Magento\Framework\App\State;
9+
use Magento\Framework\Composer\ComposerJsonFinder;
10+
use Magento\Framework\Console\Exception\GenerationDirectoryAccessException;
11+
use Magento\Framework\Filesystem\Driver\File;
12+
@@ -74,7 +73,6 @@ class Cli extends Console\Application
13+
14+
$this->assertCompilerPreparation();
15+
$this->initObjectManager();
16+
- $this->assertGenerationPermissions();
17+
} catch (\Exception $exception) {
18+
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
19+
$output->writeln(
20+
@@ -167,33 +165,6 @@ class Cli extends Console\Application
21+
$omProvider->setObjectManager($this->objectManager);
22+
}
23+
24+
- /**
25+
- * Checks whether generation directory is read-only.
26+
- * Depends on the current mode:
27+
- * production - application will proceed
28+
- * default - application will be terminated
29+
- * developer - application will be terminated
30+
- *
31+
- * @return void
32+
- * @throws GenerationDirectoryAccessException If generation directory is read-only in developer mode
33+
- */
34+
- private function assertGenerationPermissions()
35+
- {
36+
- /** @var GenerationDirectoryAccess $generationDirectoryAccess */
37+
- $generationDirectoryAccess = $this->objectManager->create(
38+
- GenerationDirectoryAccess::class,
39+
- ['serviceManager' => $this->serviceManager]
40+
- );
41+
- /** @var State $state */
42+
- $state = $this->objectManager->get(State::class);
43+
-
44+
- if ($state->getMode() !== State::MODE_PRODUCTION
45+
- && !$generationDirectoryAccess->check()
46+
- ) {
47+
- throw new GenerationDirectoryAccessException();
48+
- }
49+
- }
50+
-
51+
/**
52+
* Checks whether compiler is being prepared.
53+
*

0 commit comments

Comments
 (0)