Skip to content

Commit b2f575f

Browse files
MAGETWO-52612: CLI unaffected by permissions configuration setting in server config
1 parent a251866 commit b2f575f

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
lines changed

.htaccess

Lines changed: 4 additions & 6 deletions
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
@@ -285,6 +279,10 @@
285279
order allow,deny
286280
deny from all
287281
</Files>
282+
<Files magento_umask>
283+
order allow,deny
284+
deny from all
285+
</Files>
288286

289287
################################
290288
## If running in cluster environment, uncomment this

.htaccess.sample

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33

44
# SetEnv MAGE_MODE developer
55

6-
############################################
7-
## overrides default umask value to allow using different
8-
## file permissions
9-
10-
# SetEnv MAGE_UMASK 022
11-
126
############################################
137
## uncomment these lines for CGI mode
148
## make sure to specify the correct cgi php binary file name
@@ -251,6 +245,10 @@
251245
order allow,deny
252246
deny from all
253247
</Files>
248+
<Files magento_umask>
249+
order allow,deny
250+
deny from all
251+
</Files>
254252

255253
################################
256254
## If running in cluster environment, uncomment this

app/bootstrap.php

Lines changed: 5 additions & 4 deletions
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 (version_compare(phpversion(), '5.5.0', '<') === true) {
1915
if (PHP_SAPI == 'cli') {
@@ -34,6 +30,11 @@
3430
require_once __DIR__ . '/autoload.php';
3531
require_once BP . '/app/functions.php';
3632

33+
/* Custom umask value may be provided in optional mage_umask file in root */
34+
$umaskFile = BP . '/magento_umask';
35+
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
36+
umask($mask);
37+
3738
if (!empty($_SERVER['MAGE_PROFILER'])
3839
&& isset($_SERVER['HTTP_ACCEPT'])
3940
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false

pub/.htaccess

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33

44
# SetEnv MAGE_MODE developer
55

6-
############################################
7-
## overrides default umask value to allow using different
8-
## file permissions
9-
10-
# SetEnv MAGE_UMASK 022
11-
126
############################################
137
## uncomment these lines for CGI mode
148
## make sure to specify the correct cgi php binary file name

0 commit comments

Comments
 (0)