Skip to content

Commit a8f9177

Browse files
author
Bohdan Korablov
committed
Merge remote-tracking branch 'falcons/MAGETWO-46636' into MAGETWO-60792
2 parents b56df96 + 6ea416a commit a8f9177

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

lib/internal/Magento/Framework/App/Http.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ private function redirectToSetup(Bootstrap $bootstrap, \Exception $exception)
241241
. "because the Magento setup directory cannot be accessed. \n"
242242
. 'You can install Magento using either the command line or you must restore access '
243243
. 'to the following directory: ' . $setupInfo->getDir($projectRoot) . "\n";
244-
$newMessage .= 'If you are using the sample nginx configuration, please go to '
245-
. $this->_request->getScheme(). '://' . $this->_request->getHttpHost() . $setupInfo->getUrl();
244+
246245
throw new \Exception($newMessage, 0, $exception);
247246
}
248247
}

lib/internal/Magento/Framework/App/SetupInfo.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ public function isAvailable()
147147
{
148148
$setupDir = $this->getDir($this->projectRoot);
149149
$isSubDir = false !== strpos($setupDir . '/', $this->docRoot . '/');
150+
// Setup is not accessible from pub folder
151+
$setupDir = rtrim($setupDir, '/');
152+
$lastOccurrence = strrpos($setupDir, '/pub/setup');
153+
154+
if (false !== $lastOccurrence) {
155+
$setupDir = substr_replace($setupDir, '/setup', $lastOccurrence, strlen('/pub/setup'));
156+
}
157+
150158
return $isSubDir && realpath($setupDir);
151159
}
152160

lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ public function isAvailableDataProvider()
193193
],
194194
true
195195
],
196+
'root within doc root + pub, existent sub-directory' => [
197+
[
198+
'DOCUMENT_ROOT' => __DIR__ . '/_files/pub/',
199+
'SCRIPT_FILENAME' => __DIR__ . '/_files/pub/index.php',
200+
],
201+
true
202+
],
196203
];
197204
}
198205
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/

0 commit comments

Comments
 (0)