Skip to content

Commit cf27895

Browse files
author
Igor Miniailo
committed
Merge branch 'develop' into product-video-PR4
2 parents 11b32fd + fc7a956 commit cf27895

File tree

19 files changed

+430
-45
lines changed

19 files changed

+430
-45
lines changed

app/code/Magento/Braintree/Model/PaymentMethod.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,8 @@ protected function processSuccessResult(
918918
*/
919919
public function canVoid()
920920
{
921-
if (($order = $this->_registry->registry('current_order'))
922-
&& $order->getId() && $order->hasInvoices() ) {
921+
if ((($order = $this->_registry->registry('current_order'))
922+
&& $order->getId() && $order->hasInvoices()) || $this->_registry->registry('current_invoice')) {
923923
return false;
924924
}
925925
return $this->_canVoid;
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Model\ResourceModel;
7+
8+
use Magento\Framework\App\ResourceConnection;
9+
10+
class MaxHeapTableSizeProcessor
11+
{
12+
/**
13+
* Database connection adapter
14+
*
15+
* @var \Magento\Framework\DB\Adapter\AdapterInterface
16+
*/
17+
protected $connection;
18+
19+
/**
20+
* @var int
21+
*/
22+
protected $defaultMaxHeapTableSie;
23+
24+
/**
25+
* Current max_heap_table_size value (in Bytes)
26+
*
27+
* @var int
28+
*/
29+
protected $currentMaxHeapTableSize = null;
30+
31+
/**
32+
* @param ResourceConnection $resource
33+
*/
34+
public function __construct(ResourceConnection $resource)
35+
{
36+
$this->connection = $resource->getConnection();
37+
$this->defaultMaxHeapTableSie = 1024 * 1024 * 64;
38+
}
39+
40+
/**
41+
* Set max_heap_table_size value in Bytes. By default value is 64M
42+
*
43+
* @param int|null $maxHeapTableSize
44+
* @throws \InvalidArgumentException
45+
* @throws \RuntimeException
46+
* @return void
47+
*/
48+
public function set($maxHeapTableSize = null)
49+
{
50+
$maxHeapTableSize = (int) (null === $maxHeapTableSize ? $this->defaultMaxHeapTableSie : $maxHeapTableSize);
51+
if (!$maxHeapTableSize) {
52+
throw new \InvalidArgumentException('Wrong max_heap_table_size parameter');
53+
}
54+
55+
$this->currentMaxHeapTableSize = (int)$this->connection->fetchOne('SELECT @@session.max_heap_table_size');
56+
if (!$this->currentMaxHeapTableSize) {
57+
throw new \RuntimeException('Can not extract max_heap_table_size');
58+
}
59+
60+
$this->connection->query('SET SESSION max_heap_table_size = ' . $maxHeapTableSize);
61+
}
62+
63+
/**
64+
* Restore max_heap_table_size value
65+
*
66+
* @throws \RuntimeException
67+
* @return void
68+
*/
69+
public function restore()
70+
{
71+
if (null === $this->currentMaxHeapTableSize) {
72+
throw new \RuntimeException('max_heap_table_size parameter is not set');
73+
}
74+
$this->connection->query('SET SESSION max_heap_table_size = ' . $this->currentMaxHeapTableSize);
75+
}
76+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Plugin\Model\Indexer\Category\Product;
8+
9+
use Magento\Catalog\Model\Indexer\Category\Product\Action\Full;
10+
use Magento\Catalog\Model\ResourceModel\MaxHeapTableSizeProcessor;
11+
use Psr\Log\LoggerInterface;
12+
13+
class MaxHeapTableSizeProcessorOnFullReindex
14+
{
15+
/**
16+
* @var MaxHeapTableSizeProcessor
17+
*/
18+
protected $maxHeapTableSizeProcessor;
19+
20+
/**
21+
* @param MaxHeapTableSizeProcessor $maxHeapTableSizeProcessor
22+
* @param LoggerInterface $logger
23+
*/
24+
public function __construct(
25+
MaxHeapTableSizeProcessor $maxHeapTableSizeProcessor,
26+
LoggerInterface $logger
27+
) {
28+
$this->maxHeapTableSizeProcessor = $maxHeapTableSizeProcessor;
29+
$this->logger = $logger;
30+
}
31+
32+
/**
33+
* @param Full $subject
34+
* @return void
35+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
36+
*/
37+
public function beforeExecute(Full $subject)
38+
{
39+
try {
40+
$this->maxHeapTableSizeProcessor->set();
41+
} catch (\Exception $e) {
42+
$this->logger->error($e);
43+
}
44+
}
45+
46+
/**
47+
* @param Full $subject
48+
* @param Full $result
49+
* @return Full
50+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
51+
*/
52+
public function afterExecute(Full $subject, Full $result)
53+
{
54+
try {
55+
$this->maxHeapTableSizeProcessor->restore();
56+
} catch (\Exception $e) {
57+
$this->logger->error($e);
58+
}
59+
return $result;
60+
}
61+
}

app/code/Magento/Catalog/etc/adminhtml/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
</type>
6363
<type name="Magento\Catalog\Model\Indexer\Category\Product\Action\Full">
6464
<plugin name="invalidate_pagecache_after_full_reindex" type="Magento\Catalog\Plugin\Model\Indexer\Category\Product\Execute" />
65+
<plugin name="max_heap_tablse_size_processor_on_full_reindex" type="Magento\Catalog\Plugin\Model\Indexer\Category\Product\MaxHeapTableSizeProcessorOnFullReindex"/>
6566
</type>
6667
<type name="Magento\Catalog\Model\ResourceModel\Attribute">
6768
<plugin name="invalidate_pagecache_after_attribute_save" type="Magento\Catalog\Plugin\Model\ResourceModel\Attribute\Save" />

app/code/Magento/CustomerImportExport/etc/import.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@
99
<entity name="customer_composite" label="Customers and Addresses (single file)" model="Magento\CustomerImportExport\Model\Import\CustomerComposite" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" />
1010
<entity name="customer" label="Customers Main File" model="Magento\CustomerImportExport\Model\Import\Customer" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Custom" />
1111
<entity name="customer_address" label="Customer Addresses" model="Magento\CustomerImportExport\Model\Import\Address" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Custom" />
12+
<relatedIndexer entity="customer" name="customer_grid" />
13+
<relatedIndexer entity="customer_address" name="customer_grid" />
14+
<relatedIndexer entity="customer_composite" name="customer_grid" />
1215
</config>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
email,_website,_store,confirmation,created_at,created_in,disable_auto_group_change,dob,firstname,gender,group_id,lastname,middlename,password_hash,prefix,reward_update_notification,reward_warning_notification,rp_token,rp_token_created_at,store_id,suffix,taxvat,updated_at,website_id,password
2+
jondoe@example.com,base,default,,"2015-10-30 12:49:47","Default Store View",0,,Jon,,1,Doe,,d708be3fe0fe0120840e8b13c8faae97424252c6374227ff59c05814f1aecd79:mgLqkqgTwLPLlCljzvF8hp67fNOOvOZb:1,,,,07e71459c137f4da15292134ff459cba,"2015-10-30 12:49:48",1,,,"2015-10-30 12:49:48",1,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_website,_email,_entity_id,city,company,country_id,fax,firstname,lastname,middlename,postcode,prefix,region,region_id,street,suffix,telephone,vat_id,vat_is_valid,vat_request_date,vat_request_id,vat_request_success,_address_default_billing_,_address_default_shipping_
2+
base,jondoe@example.com,1,"New York",,US,,Jon,Doe,,10044,,"New York",43,"Main Street 1",,123456789,,,,,,1,1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_email,_website,_finance_website,store_credit,reward_points
2+
jondoe@example.com,base,base,10.0000,100

app/code/Magento/ImportExport/Model/Import/Config/Reader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Reader extends \Magento\Framework\Config\Reader\Filesystem
1515
protected $_idAttributes = [
1616
'/config/entity' => 'name',
1717
'/config/entityType' => ['entity', 'name'],
18-
'/config/relatedIndexers' => ['entity', 'name'],
18+
'/config/relatedIndexer' => ['entity', 'name'],
1919
];
2020

2121
/**

app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ public function collect(
171171
$total->setBaseTotalAmount($this->getCode(), $rate->getPrice());
172172
$shippingDescription = $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();
173173
$address->setShippingDescription(trim($shippingDescription, ' -'));
174+
$total->setShippingAmount($rate->getPrice());
175+
$total->setShippingDescription($address->getShippingDescription());
174176
break;
175177
}
176178
}
@@ -184,6 +186,7 @@ public function collect(
184186
* @param \Magento\Quote\Model\Quote $quote
185187
* @param \Magento\Quote\Model\Quote\Address\Total $total
186188
* @return array
189+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
187190
*/
188191
public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
189192
{

0 commit comments

Comments
 (0)