Skip to content

Commit 6d89067

Browse files
committed
MAGETWO-44552: [Github] Installer Readiness Check does not check file permissions recursively
- added recursive check.
1 parent 2beeb2e commit 6d89067

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

setup/src/Magento/Setup/Model/FilePermissions.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,35 @@ public function getInstallationCurrentWritableDirectories()
109109
{
110110
if (!$this->installationCurrentWritableDirectories) {
111111
foreach ($this->installationWritableDirectories as $code => $path) {
112-
if ($this->isWritable($code)) {
112+
if ($this->isWritable($code) && $this->checkRecursiveDirectories($path)) {
113113
$this->installationCurrentWritableDirectories[] = $path;
114114
}
115115
}
116116
}
117117
return $this->installationCurrentWritableDirectories;
118118
}
119119

120+
/**
121+
* Check all sub-directories
122+
*
123+
* @param string $directory
124+
* @return bool
125+
*/
126+
private function checkRecursiveDirectories($directory)
127+
{
128+
$flag = true;
129+
$directoryIterator = new \RecursiveIteratorIterator(
130+
new \RecursiveDirectoryIterator($directory),
131+
\RecursiveIteratorIterator::LEAVES_ONLY | \RecursiveIteratorIterator::CATCH_GET_CHILD
132+
);
133+
foreach($directoryIterator as $subDirectory) {
134+
if ($subDirectory->isDir() && !$subDirectory->isWritable()) {
135+
$flag = false;
136+
}
137+
}
138+
return $flag;
139+
}
140+
120141
/**
121142
* Retrieve list of currently non-writable directories for application
122143
*

setup/view/magento/setup/readiness-check/progress.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,9 @@
446446
</a>
447447
</p>
448448
<p>
449-
The best way to resolve this is to allow write permissions for the following Magento directories. The exact fix depends on your server, your host, and other system variables.
449+
The best way to resolve this is to allow write permissions for the following Magento
450+
directories and their sub-directories. The exact fix depends on your server, your host,
451+
and other system variables.
450452
<br>
451453
Our <a href="http://devdocs.magento.com/guides/v2.0/install-gde/trouble/cman/tshoot_install_perms.html" target="_blank">File Permission Help</a> can get you started.
452454
</p>

0 commit comments

Comments
 (0)