Skip to content

Commit 6ad4dc3

Browse files
author
Cari Spruiell
committed
Merge remote-tracking branch 'mainline/develop' into pull-request
2 parents 00f5bd8 + 5e4ddd4 commit 6ad4dc3

File tree

61 files changed

+1428
-2126
lines changed

Some content is hidden

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

61 files changed

+1428
-2126
lines changed

.htaccess

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206

207207
###########################################
208208
## Deny access to root files to hide sensitive application information
209-
RedirectMatch 404 /\.git
209+
RedirectMatch 403 /\.git
210210

211211
<Files composer.json>
212212
order allow,deny
@@ -277,10 +277,14 @@
277277
deny from all
278278
</Files>
279279
<Files magento_umask>
280-
order allow,deny
281-
deny from all
280+
order allow,deny
281+
deny from all
282282
</Files>
283283

284+
# For 404s and 403s that aren't handled by the application, show plain 404 response
285+
ErrorDocument 404 /pub/errors/404.php
286+
ErrorDocument 403 /pub/errors/404.php
287+
284288
################################
285289
## If running in cluster environment, uncomment this
286290
## http://developer.yahoo.com/performance/rules.html#etags

.htaccess.sample

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
############################################
2-
## Optional override of deployment mode. We recommend you use the
3-
## command bin/magento deploy:mode:set to switch modes instead
4-
# SetEnv MAGE_MODE default # or production or developer
2+
## overrides deployment configuration mode value
3+
## use command bin/magento deploy:mode:set to switch modes
4+
5+
# SetEnv MAGE_MODE developer
56

67
############################################
7-
## Uncomment these lines for CGI mode.
8-
## Make sure to specify the correct cgi php binary file name
8+
## uncomment these lines for CGI mode
9+
## make sure to specify the correct cgi php binary file name
910
## it might be /cgi-bin/php-cgi
1011

1112
# Action php5-cgi /cgi-bin/php5-cgi
@@ -16,42 +17,42 @@
1617

1718
# Options -MultiViews
1819

19-
## You might also need to add this line to php.ini
20+
## you might also need to add this line to php.ini
2021
## cgi.fix_pathinfo = 1
21-
## If it still doesn't work, rename php.ini to php5.ini
22+
## if it still doesn't work, rename php.ini to php5.ini
2223

2324
############################################
24-
## This line is specific for 1and1 hosting
25+
## this line is specific for 1and1 hosting
2526

2627
#AddType x-mapp-php5 .php
2728
#AddHandler x-mapp-php5 .php
2829

2930
############################################
30-
## Default index file
31+
## default index file
3132

3233
DirectoryIndex index.php
3334

3435
<IfModule mod_php5.c>
3536

3637
############################################
37-
## Adjust memory limit
38+
## adjust memory limit
3839

3940
php_value memory_limit 768M
4041
php_value max_execution_time 18000
4142

4243
############################################
43-
## Disable automatic session start
44+
## disable automatic session start
4445
## before autoload was initialized
4546

4647
php_flag session.auto_start off
4748

4849
############################################
49-
## Enable resulting html compression
50+
## enable resulting html compression
5051

5152
#php_flag zlib.output_compression on
5253

5354
###########################################
54-
## Disable user agent verification to not break multiple image upload
55+
## disable user agent verification to not break multiple image upload
5556

5657
php_flag suhosin.session.cryptua off
5758

@@ -60,32 +61,32 @@
6061
<IfModule mod_php7.c>
6162

6263
############################################
63-
## Adjust memory limit
64+
## adjust memory limit
6465

6566
php_value memory_limit 768M
6667
php_value max_execution_time 18000
6768

6869
############################################
69-
## Disable automatic session start
70+
## disable automatic session start
7071
## before autoload was initialized
7172

7273
php_flag session.auto_start off
7374

7475
############################################
75-
## Enable resulting html compression
76+
## enable resulting html compression
7677

7778
#php_flag zlib.output_compression on
7879

7980
###########################################
80-
## Disable user agent verification to not break multiple image upload
81+
## disable user agent verification to not break multiple image upload
8182

8283
php_flag suhosin.session.cryptua off
8384

8485
</IfModule>
8586

8687
<IfModule mod_security.c>
8788
###########################################
88-
## Disable POST processing to not break multiple image upload
89+
## disable POST processing to not break multiple image upload
8990

9091
SecFilterEngine Off
9192
SecFilterScanPOST Off
@@ -94,7 +95,7 @@
9495
<IfModule mod_deflate.c>
9596

9697
############################################
97-
## Enable apache served files compression
98+
## enable apache served files compression
9899
## http://developer.yahoo.com/performance/rules.html#gzip
99100

100101
# Insert filter on all content
@@ -122,14 +123,14 @@
122123
<IfModule mod_ssl.c>
123124

124125
############################################
125-
## Make HTTPS env vars available for CGI mode
126+
## make HTTPS env vars available for CGI mode
126127

127128
SSLOptions StdEnvVars
128129

129130
</IfModule>
130131

131132
############################################
132-
## Workaround for Apache 2.4.6 CentOS build when working via ProxyPassMatch with HHVM (or any other)
133+
## workaround for Apache 2.4.6 CentOS build when working via ProxyPassMatch with HHVM (or any other)
133134
## Please, set it on virtual host configuration level
134135

135136
## SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
@@ -138,19 +139,19 @@
138139
<IfModule mod_rewrite.c>
139140

140141
############################################
141-
## Enable rewrites
142+
## enable rewrites
142143

143144
Options +FollowSymLinks
144145
RewriteEngine on
145146

146147
############################################
147-
## You can put here your magento root folder
148+
## you can put here your magento root folder
148149
## path relative to web root
149150

150151
#RewriteBase /magento/
151152

152153
############################################
153-
## Workaround for HTTP authorization
154+
## workaround for HTTP authorization
154155
## in CGI environment
155156

156157
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
@@ -162,21 +163,21 @@
162163
RewriteRule .* - [L,R=405]
163164

164165
############################################
165-
## Redirect for mobile user agents
166+
## redirect for mobile user agents
166167

167168
#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
168169
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
169170
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
170171

171172
############################################
172-
## Never rewrite for existing files, directories and links
173+
## never rewrite for existing files, directories and links
173174

174175
RewriteCond %{REQUEST_FILENAME} !-f
175176
RewriteCond %{REQUEST_FILENAME} !-d
176177
RewriteCond %{REQUEST_FILENAME} !-l
177178

178179
############################################
179-
## Rewrite everything else to index.php
180+
## rewrite everything else to index.php
180181

181182
RewriteRule .* index.php [L]
182183

@@ -205,7 +206,7 @@
205206

206207
###########################################
207208
## Deny access to root files to hide sensitive application information
208-
RedirectMatch 404 /\.git
209+
RedirectMatch 403 /\.git
209210

210211
<Files composer.json>
211212
order allow,deny
@@ -280,6 +281,10 @@
280281
deny from all
281282
</Files>
282283

284+
# For 404s and 403s that aren't handled by the application, show plain 404 response
285+
ErrorDocument 404 /pub/errors/404.php
286+
ErrorDocument 403 /pub/errors/404.php
287+
283288
################################
284289
## If running in cluster environment, uncomment this
285290
## http://developer.yahoo.com/performance/rules.html#etags

app/code/Magento/Catalog/Block/Product/View.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Catalog\Block\Product;
77

88
use Magento\Catalog\Api\ProductRepositoryInterface;
9+
use Magento\Catalog\Model\Category;
910
use Magento\Catalog\Model\Product;
1011

1112
/**
@@ -55,7 +56,7 @@ class View extends AbstractProduct implements \Magento\Framework\DataObject\Iden
5556
* @var \Magento\Customer\Model\Session
5657
*/
5758
protected $customerSession;
58-
59+
5960
/**
6061
* @var ProductRepositoryInterface
6162
*/
@@ -371,7 +372,7 @@ public function getIdentities()
371372
$identities = $this->getProduct()->getIdentities();
372373
$category = $this->_coreRegistry->registry('current_category');
373374
if ($category) {
374-
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $category->getId();
375+
$identities[] = Category::CACHE_TAG . '_' . $category->getId();
375376
}
376377
return $identities;
377378
}

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ public function initializeFromData(\Magento\Catalog\Model\Product $product, arra
178178
foreach ($useDefaults as $attributeCode => $useDefaultState) {
179179
if ($useDefaultState) {
180180
$product->setData($attributeCode, null);
181+
// UI component sends value even if field is disabled, so 'Use Config Settings' must be reset to false
182+
if ($product->hasData('use_config_' . $attributeCode)) {
183+
$product->setData('use_config_' . $attributeCode, false);
184+
}
181185
}
182186
}
183187

@@ -215,7 +219,7 @@ public function initializeFromData(\Magento\Catalog\Model\Product $product, arra
215219

216220
return $product;
217221
}
218-
222+
219223
/**
220224
* Initialize product before saving
221225
*
@@ -310,7 +314,7 @@ public function mergeProductOptions($productOptions, $overwriteOptions)
310314
if (!is_array($overwriteOptions)) {
311315
return $productOptions;
312316
}
313-
317+
314318
foreach ($productOptions as $index => $option) {
315319
$optionId = $option['option_id'];
316320

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,17 +2269,40 @@ public function getIdentities()
22692269
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
22702270
}
22712271
}
2272-
if ($this->getOrigData('status') != $this->getData('status')) {
2272+
2273+
if (($this->getOrigData('status') != $this->getData('status')) || $this->isStockStatusChanged()) {
22732274
foreach ($this->getCategoryIds() as $categoryId) {
22742275
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
22752276
}
22762277
}
22772278
if ($this->_appState->getAreaCode() == \Magento\Framework\App\Area::AREA_FRONTEND) {
22782279
$identities[] = self::CACHE_TAG;
22792280
}
2281+
22802282
return array_unique($identities);
22812283
}
22822284

2285+
/**
2286+
* Check whether stock status changed
2287+
*
2288+
* @return bool
2289+
*/
2290+
private function isStockStatusChanged()
2291+
{
2292+
$stockItem = null;
2293+
$extendedAttributes = $this->getExtensionAttributes();
2294+
if ($extendedAttributes !== null) {
2295+
$stockItem = $extendedAttributes->getStockItem();
2296+
}
2297+
$stockData = $this->getStockData();
2298+
return (
2299+
(is_array($stockData))
2300+
&& array_key_exists('is_in_stock', $stockData)
2301+
&& (null !== $stockItem)
2302+
&& ($stockItem->getIsInStock() != $stockData['is_in_stock'])
2303+
);
2304+
}
2305+
22832306
/**
22842307
* Reload PriceInfo object
22852308
*

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Model\Product\Attribute\Backend;
77

8+
use Magento\Catalog\Model\Product\Attribute\Source\Boolean as BooleanSource;
9+
810
/**
911
* Product attribute for enable/disable option
1012
*
@@ -22,7 +24,7 @@ public function beforeSave($object)
2224
{
2325
$attributeCode = $this->getAttribute()->getName();
2426
if ($object->getData('use_config_' . $attributeCode)) {
25-
$object->setData($attributeCode, '');
27+
$object->setData($attributeCode, BooleanSource::VALUE_USE_CONFIG);
2628
}
2729
return $this;
2830
}

app/code/Magento/Catalog/Model/Product/Attribute/Source/Boolean.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
class Boolean extends \Magento\Eav\Model\Entity\Attribute\Source\Boolean
1515
{
16+
/**
17+
* Value of 'Use Config' option
18+
*/
19+
const VALUE_USE_CONFIG = 2;
20+
1621
/**
1722
* Retrieve all attribute options
1823
*
@@ -22,9 +27,9 @@ public function getAllOptions()
2227
{
2328
if (!$this->_options) {
2429
$this->_options = [
25-
['label' => __('Yes'), 'value' => 1],
26-
['label' => __('No'), 'value' => 0],
27-
['label' => __('Use config'), 'value' => 2],
30+
['label' => __('Yes'), 'value' => static::VALUE_YES],
31+
['label' => __('No'), 'value' => static::VALUE_NO],
32+
['label' => __('Use config'), 'value' => static::VALUE_USE_CONFIG],
2833
];
2934
}
3035
return $this->_options;

app/code/Magento/Catalog/Test/Unit/Block/Product/ViewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ public function testGetIdentities()
8484
]
8585
)
8686
);
87-
$this->assertEquals(['catalog_product_1', 'catalog_category_product_1'], $this->view->getIdentities());
87+
$this->assertEquals(['catalog_product_1', 'catalog_category_1'], $this->view->getIdentities());
8888
}
8989
}

0 commit comments

Comments
 (0)