Skip to content

Commit b51fc96

Browse files
MAGETWO-52667: CLI unaffected by permissions configuration setting in server config [develop branch]
- use magento_umask file to store custom umask
1 parent 392644b commit b51fc96

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

.htaccess

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44

55
# SetEnv MAGE_MODE developer
66

7-
############################################
8-
## overrides default umask value to allow using different
9-
## file permissions
10-
11-
# SetEnv MAGE_UMASK 022
12-
137
############################################
148
## uncomment these lines for CGI mode
159
## make sure to specify the correct cgi php binary file name
@@ -281,6 +275,10 @@
281275
order allow,deny
282276
deny from all
283277
</Files>
278+
<Files magento_umask>
279+
order allow,deny
280+
deny from all
281+
</Files>
284282

285283
################################
286284
## If running in cluster environment, uncomment this

.htaccess.sample

+4
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@
274274
order allow,deny
275275
deny from all
276276
</Files>
277+
<Files magento_umask>
278+
order allow,deny
279+
deny from all
280+
</Files>
277281

278282
################################
279283
## If running in cluster environment, uncomment this

app/bootstrap.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
error_reporting(E_ALL);
1111
#ini_set('display_errors', 1);
1212

13-
/* Custom umask value may be provided in MAGE_UMASK environment variable */
14-
$mask = isset($_SERVER['MAGE_UMASK']) ? octdec($_SERVER['MAGE_UMASK']) : 002;
15-
umask($mask);
16-
1713
/* PHP version validation */
1814
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50522) {
1915
if (PHP_SAPI == 'cli') {
@@ -31,6 +27,11 @@
3127
exit(1);
3228
}
3329

30+
/* Custom umask value may be provided in optional mage_umask file in root */
31+
$umaskFile = BP . '/magento_umask';
32+
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
33+
umask($mask);
34+
3435
require_once __DIR__ . '/autoload.php';
3536
require_once BP . '/app/functions.php';
3637

pub/.htaccess

-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44

55
# SetEnv MAGE_MODE default # or production or developer
66

7-
############################################
8-
## Overrides default umask value to allow using different
9-
## file permissions
10-
11-
# SetEnv MAGE_UMASK 022
12-
137
############################################
148
## Uncomment these lines for CGI mode.
159
## Make sure to specify the correct cgi php binary file name

0 commit comments

Comments
 (0)