Skip to content

Commit 7d537d0

Browse files
author
Dale Sikkema
committed
Merge branch 'MAGETWO-50788-optional-umask' into MAGETWO-50795-move-catalogimportexportstaging-to-ee
2 parents b1b4eb9 + 1873b45 commit 7d537d0

File tree

55 files changed

+1398
-108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1398
-108
lines changed

.htaccess

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
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+
713
############################################
814
## uncomment these lines for CGI mode
915
## make sure to specify the correct cgi php binary file name

app/bootstrap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
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+
1317
/* PHP version validation */
1418
if (version_compare(phpversion(), '5.5.0', '<') === true) {
1519
if (PHP_SAPI == 'cli') {

app/code/Magento/Backend/Helper/Dashboard/Order.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ public function __construct(
3535
}
3636

3737
/**
38-
* @return \Magento\SalesRule\Model\RuleFactory
38+
* The getter function to get the new StoreManager dependency
39+
*
40+
* @return \Magento\Store\Model\StoreManagerInterface
41+
*
3942
* @deprecated
4043
*/
41-
public function getStoreManager()
44+
private function getStoreManager()
4245
{
43-
if ($this->_storeManager instanceof \Magento\Store\Model\StoreManagerInterface) {
44-
$this->_storeManager = ObjectManager::getInstance()->get('\Magento\Store\Model\StoreManagerInterface');
46+
if ($this->_storeManager === null) {
47+
$this->_storeManager = ObjectManager::getInstance()->get('Magento\Store\Model\StoreManagerInterface');
4548
}
49+
return $this->_storeManager;
4650
}
4751

4852
/**
@@ -57,15 +61,15 @@ protected function _initCollection()
5761
if ($this->getParam('store')) {
5862
$this->_collection->addFieldToFilter('store_id', $this->getParam('store'));
5963
} elseif ($this->getParam('website')) {
60-
$storeIds = $this->_storeManager->getWebsite($this->getParam('website'))->getStoreIds();
64+
$storeIds = $this->getStoreManager()->getWebsite($this->getParam('website'))->getStoreIds();
6165
$this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]);
6266
} elseif ($this->getParam('group')) {
63-
$storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds();
67+
$storeIds = $this->getStoreManager()->getGroup($this->getParam('group'))->getStoreIds();
6468
$this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]);
6569
} elseif (!$this->_collection->isLive()) {
6670
$this->_collection->addFieldToFilter(
6771
'store_id',
68-
['eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()]
72+
['eq' => $this->getStoreManager()->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()]
6973
);
7074
}
7175
$this->_collection->load();

app/code/Magento/CacheInvalidate/Observer/InvalidateVarnishObserver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ public function execute(\Magento\Framework\Event\Observer $observer)
4848
$tags = [];
4949
$pattern = "((^|,)%s(,|$))";
5050
foreach ($object->getIdentities() as $tag) {
51-
$tags[] = sprintf($pattern, preg_replace("~_\\d+$~", '', $tag));
5251
$tags[] = sprintf($pattern, $tag);
5352
}
54-
$this->purgeCache->sendPurgeRequest(implode('|', array_unique($tags)));
53+
if (!empty($tags)) {
54+
$this->purgeCache->sendPurgeRequest(implode('|', array_unique($tags)));
55+
}
5556
}
5657
}
5758
}

app/code/Magento/CacheInvalidate/Test/Unit/Observer/InvalidateVarnishObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected function setUp()
5555
public function testInvalidateVarnish()
5656
{
5757
$tags = ['cache_1', 'cache_group'];
58-
$pattern = '((^|,)cache(,|$))|((^|,)cache_1(,|$))|((^|,)cache_group(,|$))';
58+
$pattern = '((^|,)cache_1(,|$))|((^|,)cache_group(,|$))';
5959

6060
$this->configMock->expects($this->once())->method('isEnabled')->will($this->returnValue(true));
6161
$this->configMock->expects(

app/code/Magento/Catalog/Model/Product.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
307307
*/
308308
protected $_productIdCached;
309309

310+
/**
311+
* @var \Magento\Framework\App\State
312+
*/
313+
private $appState;
314+
310315
/**
311316
* List of attributes in ProductInterface
312317
* @var array
@@ -2263,6 +2268,9 @@ public function getIdentities()
22632268
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
22642269
}
22652270
}
2271+
if ($this->getAppState()->getAreaCode() == \Magento\Framework\App\Area::AREA_FRONTEND) {
2272+
$identities[] = self::CACHE_TAG;
2273+
}
22662274
return array_unique($identities);
22672275
}
22682276

@@ -2548,4 +2556,20 @@ public function setId($value)
25482556
{
25492557
return $this->setData('entity_id', $value);
25502558
}
2559+
2560+
/**
2561+
* Get application state
2562+
*
2563+
* @deprecated
2564+
* @return \Magento\Framework\App\State
2565+
*/
2566+
private function getAppState()
2567+
{
2568+
if (!$this->appState instanceof \Magento\Framework\App\State) {
2569+
$this->appState = \Magento\Framework\App\ObjectManager::getInstance()->get(
2570+
\Magento\Framework\App\State::class
2571+
);
2572+
}
2573+
return $this->appState;
2574+
}
25512575
}

app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase
166166
/** @var \PHPUnit_Framework_MockObject_MockObject */
167167
protected $mediaConfig;
168168

169+
/**
170+
* @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject
171+
*/
172+
private $appStateMock;
173+
169174
/**
170175
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
171176
*/
@@ -365,6 +370,14 @@ protected function setUp()
365370
]
366371
);
367372

373+
$this->appStateMock = $this->getMockBuilder(\Magento\Framework\App\State::class)
374+
->disableOriginalConstructor()
375+
->setMethods([])
376+
->getMock();
377+
$modelReflection = new \ReflectionClass(get_class($this->model));
378+
$appStateReflection = $modelReflection->getProperty('appState');
379+
$appStateReflection->setAccessible(true);
380+
$appStateReflection->setValue($this->model, $this->appStateMock);
368381
}
369382

370383
public function testGetAttributes()

app/code/Magento/Catalog/etc/webapi.xml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
<route url="/V1/products" method="GET">
3131
<service class="Magento\Catalog\Api\ProductRepositoryInterface" method="getList"/>
3232
<resources>
33-
<resource ref="anonymous" />
33+
<resource ref="Magento_Catalog::products" />
3434
</resources>
3535
</route>
3636
<route url="/V1/products/:sku" method="GET">
3737
<service class="Magento\Catalog\Api\ProductRepositoryInterface" method="get"/>
3838
<resources>
39-
<resource ref="anonymous" />
39+
<resource ref="Magento_Catalog::products" />
4040
</resources>
4141
</route>
4242

@@ -49,7 +49,7 @@
4949
<route url="/V1/products/attributes/:attributeCode" method="GET">
5050
<service class="Magento\Catalog\Api\ProductAttributeRepositoryInterface" method="get"/>
5151
<resources>
52-
<resource ref="anonymous" />
52+
<resource ref="Magento_Catalog::attributes_attributes" />
5353
</resources>
5454
</route>
5555
<route url="/V1/products/attributes" method="GET">
@@ -97,19 +97,19 @@
9797
<route url="/V1/products/types" method="GET">
9898
<service class="Magento\Catalog\Api\ProductTypeListInterface" method="getProductTypes"/>
9999
<resources>
100-
<resource ref="anonymous"/>
100+
<resource ref="Magento_Catalog::products"/>
101101
</resources>
102102
</route>
103103
<route url="/V1/products/attribute-sets/sets/list" method="GET">
104104
<service class="Magento\Catalog\Api\AttributeSetRepositoryInterface" method="getList"/>
105105
<resources>
106-
<resource ref="anonymous"/>
106+
<resource ref="Magento_Catalog::sets"/>
107107
</resources>
108108
</route>
109109
<route url="/V1/products/attribute-sets/:attributeSetId" method="GET">
110110
<service class="Magento\Catalog\Api\AttributeSetRepositoryInterface" method="get"/>
111111
<resources>
112-
<resource ref="anonymous"/>
112+
<resource ref="Magento_Catalog::sets"/>
113113
</resources>
114114
</route>
115115
<route url="/V1/products/attribute-sets/:attributeSetId" method="DELETE">
@@ -133,7 +133,7 @@
133133
<route url="/V1/products/attribute-sets/:attributeSetId/attributes" method="GET">
134134
<service class="Magento\Catalog\Api\ProductAttributeManagementInterface" method="getAttributes"/>
135135
<resources>
136-
<resource ref="anonymous"/>
136+
<resource ref="Magento_Catalog::sets"/>
137137
</resources>
138138
</route>
139139
<route url="/V1/products/attribute-sets/attributes" method="POST">
@@ -151,7 +151,7 @@
151151
<route url="/V1/products/attribute-sets/groups/list" method="GET">
152152
<service class="Magento\Catalog\Api\ProductAttributeGroupRepositoryInterface" method="getList"/>
153153
<resources>
154-
<resource ref="anonymous"/>
154+
<resource ref="Magento_Catalog::sets"/>
155155
</resources>
156156
</route>
157157
<route url="/V1/products/attribute-sets/groups" method="POST">
@@ -175,7 +175,7 @@
175175
<route url="/V1/products/attributes/:attributeCode/options" method="GET">
176176
<service class="Magento\Catalog\Api\ProductAttributeOptionManagementInterface" method="getItems"/>
177177
<resources>
178-
<resource ref="anonymous" />
178+
<resource ref="Magento_Catalog::attributes_attributes" />
179179
</resources>
180180
</route>
181181
<route url="/V1/products/attributes/:attributeCode/options" method="POST">
@@ -193,13 +193,13 @@
193193
<route url="/V1/products/media/types/:attributeSetName" method="GET">
194194
<service class="Magento\Catalog\Api\ProductMediaAttributeManagementInterface" method="getList"/>
195195
<resources>
196-
<resource ref="anonymous"/>
196+
<resource ref="Magento_Catalog::attributes_attributes"/>
197197
</resources>
198198
</route>
199199
<route url="/V1/products/:sku/media/:entryId" method="GET">
200200
<service class="Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface" method="get"/>
201201
<resources>
202-
<resource ref="anonymous"/>
202+
<resource ref="Magento_Catalog::attributes_attributes"/>
203203
</resources>
204204
</route>
205205
<route url="/V1/products/:sku/media" method="POST">
@@ -223,15 +223,15 @@
223223
<route url="/V1/products/:sku/media" method="GET">
224224
<service class="Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface" method="getList"/>
225225
<resources>
226-
<resource ref="anonymous"/>
226+
<resource ref="Magento_Catalog::catalog"/>
227227
</resources>
228228
</route>
229229

230230
<!-- Tier Price -->
231231
<route url="/V1/products/:sku/group-prices/:customerGroupId/tiers" method="GET">
232232
<service class="Magento\Catalog\Api\ProductTierPriceManagementInterface" method="getList"/>
233233
<resources>
234-
<resource ref="anonymous"/>
234+
<resource ref="Magento_Catalog::catalog"/>
235235
</resources>
236236
</route>
237237
<route url="/V1/products/:sku/group-prices/:customerGroupId/tiers/:qty/price/:price" method="POST">
@@ -256,7 +256,7 @@
256256
<route url="/V1/categories/:categoryId" method="GET">
257257
<service class="Magento\Catalog\Api\CategoryRepositoryInterface" method="get" />
258258
<resources>
259-
<resource ref="anonymous" />
259+
<resource ref="Magento_Catalog::categories" />
260260
</resources>
261261
</route>
262262
<route url="/V1/categories" method="POST">
@@ -268,7 +268,7 @@
268268
<route url="/V1/categories" method="GET">
269269
<service class="Magento\Catalog\Api\CategoryManagementInterface" method="getTree" />
270270
<resources>
271-
<resource ref="anonymous" />
271+
<resource ref="Magento_Catalog::categories" />
272272
</resources>
273273
</route>
274274
<route url="/V1/categories/:id" method="PUT">
@@ -294,13 +294,13 @@
294294
<route url="/V1/products/:sku/options" method="GET">
295295
<service class="Magento\Catalog\Api\ProductCustomOptionRepositoryInterface" method="getList"/>
296296
<resources>
297-
<resource ref="anonymous"/>
297+
<resource ref="Magento_Catalog::catalog"/>
298298
</resources>
299299
</route>
300300
<route url="/V1/products/:sku/options/:optionId" method="GET">
301301
<service class="Magento\Catalog\Api\ProductCustomOptionRepositoryInterface" method="get"/>
302302
<resources>
303-
<resource ref="anonymous"/>
303+
<resource ref="Magento_Catalog::catalog"/>
304304
</resources>
305305
</route>
306306
<route url="/V1/products/options" method="POST">
@@ -326,19 +326,19 @@
326326
<route url="/V1/products/links/types" method="GET">
327327
<service class="Magento\Catalog\Api\ProductLinkTypeListInterface" method="getItems"/>
328328
<resources>
329-
<resource ref="anonymous"/>
329+
<resource ref="Magento_Catalog::catalog"/>
330330
</resources>
331331
</route>
332332
<route url="/V1/products/links/:type/attributes" method="GET">
333333
<service class="Magento\Catalog\Api\ProductLinkTypeListInterface" method="getItemAttributes"/>
334334
<resources>
335-
<resource ref="anonymous"/>
335+
<resource ref="Magento_Catalog::catalog"/>
336336
</resources>
337337
</route>
338338
<route url="/V1/products/:sku/links/:type" method="GET">
339339
<service class="Magento\Catalog\Api\ProductLinkManagementInterface" method="getLinkedItemsByType"/>
340340
<resources>
341-
<resource ref="anonymous"/>
341+
<resource ref="Magento_Catalog::catalog"/>
342342
</resources>
343343
</route>
344344
<route url="/V1/products/:sku/links" method="POST">
@@ -364,7 +364,7 @@
364364
<route url="/V1/categories/:categoryId/products" method="GET">
365365
<service class="Magento\Catalog\Api\CategoryLinkManagementInterface" method="getAssignedProducts" />
366366
<resources>
367-
<resource ref="anonymous" />
367+
<resource ref="Magento_Catalog::categories" />
368368
</resources>
369369
</route>
370370
<route url="/V1/categories/:categoryId/products" method="POST">

app/code/Magento/CatalogInventory/etc/webapi.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<route url="/V1/stockStatuses/:productSku" method="GET">
2929
<service class="Magento\CatalogInventory\Api\StockRegistryInterface" method="getStockStatusBySku"/>
3030
<resources>
31-
<resource ref="anonymous"/>
31+
<resource ref="Magento_CatalogInventory::cataloginventory"/>
3232
</resources>
3333
</route>
3434
</routes>

app/code/Magento/Cms/etc/webapi.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<route url="/V1/cmsPage/:pageId" method="GET">
1212
<service class="Magento\Cms\Api\PageRepositoryInterface" method="getById"/>
1313
<resources>
14-
<resource ref="anonymous"/>
14+
<resource ref="Magento_Cms::page"/>
1515
</resources>
1616
</route>
1717
<route url="/V1/cmsPage/search" method="GET">
@@ -42,7 +42,7 @@
4242
<route url="/V1/cmsBlock/:blockId" method="GET">
4343
<service class="Magento\Cms\Api\BlockRepositoryInterface" method="getById"/>
4444
<resources>
45-
<resource ref="anonymous"/>
45+
<resource ref="Magento_Cms::block"/>
4646
</resources>
4747
</route>
4848
<route url="/V1/cmsBlock/search" method="GET">

0 commit comments

Comments
 (0)