Skip to content

Commit 29bec0e

Browse files
Merge remote-tracking branch 'mainline/develop' into BUGS
2 parents 91e2522 + 08b6497 commit 29bec0e

File tree

24 files changed

+535
-242
lines changed

24 files changed

+535
-242
lines changed

.htaccess

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
############################################
2+
## uncomment the line below to enable developer mode
3+
4+
# SetEnv MAGE_MODE developer
5+
16
############################################
27
## uncomment these lines for CGI mode
38
## make sure to specify the correct cgi php binary file name
@@ -167,6 +172,8 @@
167172
## http://developer.yahoo.com/performance/rules.html#expires
168173

169174
ExpiresDefault "access plus 1 year"
175+
ExpiresByType text/html A0
176+
ExpiresByType text/plain A0
170177

171178
</IfModule>
172179

.htaccess.sample

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
############################################
2+
## uncomment the line below to enable developer mode
3+
4+
# SetEnv MAGE_MODE developer
5+
16
############################################
27
## uncomment these lines for CGI mode
38
## make sure to specify the correct cgi php binary file name
@@ -164,6 +169,8 @@
164169
## http://developer.yahoo.com/performance/rules.html#expires
165170

166171
ExpiresDefault "access plus 1 year"
172+
ExpiresByType text/html A0
173+
ExpiresByType text/plain A0
167174

168175
</IfModule>
169176

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<input class="bundle-option-<?php echo $_option->getId() ?> checkbox product bundle option change-container-classname"
3030
id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"
3131
type="checkbox"
32-
<?php if ($_option->getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':true}"'?>
32+
<?php if ($_option->getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^=&quot;bundle_option[' . $_option->getId() . ']&quot;]:checked\'}"'?>
3333
name="bundle_option[<?php echo $_option->getId() ?>][<?php echo $_selection->getId() ?>]"
3434
<?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?>
3535
<?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>

app/code/Magento/Cron/Model/Observer.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,13 @@ protected function _cleanup($groupId)
345345
return $this;
346346
}
347347

348+
// check how long the record should stay unprocessed before marked as MISSED
349+
$scheduleLifetime = (int)$this->_scopeConfig->getValue(
350+
'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_LIFETIME,
351+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
352+
);
353+
$scheduleLifetime = $scheduleLifetime * self::SECONDS_IN_MINUTE;
354+
348355
/**
349356
* @var \Magento\Cron\Model\Resource\Schedule\Collection $history
350357
*/
@@ -370,7 +377,9 @@ protected function _cleanup($groupId)
370377
$now = $this->timezone->scopeTimeStamp();
371378
/** @var Schedule $record */
372379
foreach ($history as $record) {
373-
if (strtotime($record->getExecutedAt()) < $now - $historyLifetimes[$record->getStatus()]) {
380+
$checkTime = $record->getExecutedAt() ? strtotime($record->getExecutedAt()) :
381+
strtotime($record->getScheduledAt()) + $scheduleLifetime;
382+
if ($checkTime < $now - $historyLifetimes[$record->getStatus()]) {
374383
$record->delete();
375384
}
376385
}

app/code/Magento/Cron/Test/Unit/Model/ObserverTest.php

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Cron\Test\Unit\Model;
77

8+
use Magento\Cron\Model\Schedule;
9+
810
/**
911
* Class \Magento\Cron\Test\Unit\Model\ObserverTest
1012
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -607,4 +609,84 @@ public function testDispatchCleanup()
607609

608610
$this->_observer->dispatch('');
609611
}
612+
613+
public function testMissedJobsCleanedInTime()
614+
{
615+
/* 1. Initialize dependencies of _generate() method which is called first */
616+
$jobConfig = [
617+
'test_group' => ['test_job1' => ['instance' => 'CronJob', 'method' => 'execute']],
618+
];
619+
620+
// This item was scheduled 2 days ago
621+
$schedule1 = $this->getMockBuilder(
622+
'Magento\Cron\Model\Schedule'
623+
)->disableOriginalConstructor()->setMethods(
624+
['getExecutedAt', 'getScheduledAt', 'getStatus', 'delete', '__wakeup']
625+
)->getMock();
626+
$schedule1->expects($this->any())->method('getExecutedAt')->will($this->returnValue(null));
627+
$schedule1->expects($this->any())->method('getScheduledAt')->will($this->returnValue('-2 day -1 hour'));
628+
$schedule1->expects($this->any())->method('getStatus')->will($this->returnValue(Schedule::STATUS_MISSED));
629+
//we expect this job be deleted from the list
630+
$schedule1->expects($this->once())->method('delete')->will($this->returnValue(true));
631+
632+
// This item was scheduled 1 day ago
633+
$schedule2 = $this->getMockBuilder(
634+
'Magento\Cron\Model\Schedule'
635+
)->disableOriginalConstructor()->setMethods(
636+
['getExecutedAt', 'getScheduledAt', 'getStatus', 'delete', '__wakeup']
637+
)->getMock();
638+
$schedule2->expects($this->any())->method('getExecutedAt')->will($this->returnValue(null));
639+
$schedule2->expects($this->any())->method('getScheduledAt')->will($this->returnValue('-1 day'));
640+
$schedule2->expects($this->any())->method('getStatus')->will($this->returnValue(Schedule::STATUS_MISSED));
641+
//we don't expect this job be deleted from the list
642+
$schedule2->expects($this->never())->method('delete');
643+
644+
$this->_collection->addItem($schedule1);
645+
$this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig));
646+
647+
//get configuration value CACHE_KEY_LAST_HISTORY_CLEANUP_AT in the "_generate()"
648+
$this->_cache->expects($this->at(0))->method('load')->will($this->returnValue(time() + 10000000));
649+
//get configuration value CACHE_KEY_LAST_HISTORY_CLEANUP_AT in the "_cleanup()"
650+
$this->_cache->expects($this->at(1))->method('load')->will($this->returnValue(time() - 10000000));
651+
652+
$this->_scopeConfig->expects($this->at(0))->method('getValue')
653+
->with($this->equalTo('system/cron/test_group/use_separate_process'))
654+
->will($this->returnValue(0));
655+
$this->_scopeConfig->expects($this->at(1))->method('getValue')
656+
->with($this->equalTo('system/cron/test_group/schedule_generate_every'))
657+
->will($this->returnValue(0));
658+
$this->_scopeConfig->expects($this->at(2))->method('getValue')
659+
->with($this->equalTo('system/cron/test_group/history_cleanup_every'))
660+
->will($this->returnValue(0));
661+
$this->_scopeConfig->expects($this->at(3))->method('getValue')
662+
->with($this->equalTo('system/cron/test_group/schedule_lifetime'))
663+
->will($this->returnValue(2*24*60));
664+
$this->_scopeConfig->expects($this->at(4))->method('getValue')
665+
->with($this->equalTo('system/cron/test_group/history_success_lifetime'))
666+
->will($this->returnValue(0));
667+
$this->_scopeConfig->expects($this->at(5))->method('getValue')
668+
->with($this->equalTo('system/cron/test_group/history_failure_lifetime'))
669+
->will($this->returnValue(0));
670+
671+
/* 2. Initialize dependencies of _cleanup() method which is called second */
672+
$scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock();
673+
$scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection));
674+
$this->_scheduleFactory->expects($this->at(0))->method('create')->will($this->returnValue($scheduleMock));
675+
676+
$collection = $this->getMockBuilder(
677+
'Magento\Cron\Model\Resource\Schedule\Collection'
678+
)->setMethods(
679+
['addFieldToFilter', 'load', '__wakeup']
680+
)->disableOriginalConstructor()->getMock();
681+
$collection->expects($this->any())->method('addFieldToFilter')->will($this->returnSelf());
682+
$collection->expects($this->any())->method('load')->will($this->returnSelf());
683+
$collection->addItem($schedule1);
684+
$collection->addItem($schedule2);
685+
686+
$scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock();
687+
$scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($collection));
688+
$this->_scheduleFactory->expects($this->at(1))->method('create')->will($this->returnValue($scheduleMock));
689+
690+
$this->_observer->dispatch('');
691+
}
610692
}

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ protected function sendPasswordResetNotificationEmail($customer)
839839
$storeId = $this->getWebsiteStoreId($customer);
840840
}
841841

842+
$customerEmailData = $this->getFullCustomerObject($customer);
842843
/** @var \Magento\Framework\Mail\TransportInterface $transport */
843844
$transport = $this->transportBuilder->setTemplateIdentifier(
844845
$this->scopeConfig->getValue(
@@ -849,7 +850,7 @@ protected function sendPasswordResetNotificationEmail($customer)
849850
)->setTemplateOptions(
850851
['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
851852
)->setTemplateVars(
852-
['customer' => $customer, 'store' => $this->storeManager->getStore($storeId)]
853+
['customer' => $customerEmailData, 'store' => $this->storeManager->getStore($storeId)]
853854
)->setFrom(
854855
$this->scopeConfig->getValue(
855856
self::XML_PATH_FORGOT_EMAIL_IDENTITY,

app/code/Magento/Customer/etc/data_source/customer_address.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</field>
5050
<field name="region" source="eav" formElement="input" visible="false"/>
5151

52-
<field name="postcode" source="eav" formElement="post_code_fix" >
52+
<field name="postcode" source="eav" formElement="post_code" >
5353
<constraints>
5454
<validate name="required-entry"/>
5555
</constraints>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Developer\Model\Less\FileGenerator;
7+
8+
use Magento\Framework\Less\FileGenerator\RelatedGenerator;
9+
use Magento\Framework\View\Asset\LocalInterface;
10+
11+
/**
12+
* Class PublicationDecorator
13+
* Decorates generator of related assets and publishes them
14+
*
15+
* @package Magento\Developer\Model\Less\FileGenerator
16+
*/
17+
class PublicationDecorator extends RelatedGenerator
18+
{
19+
/**
20+
* @var \Magento\Framework\App\View\Asset\Publisher
21+
*/
22+
private $publisher;
23+
24+
/**
25+
* @param \Magento\Framework\Filesystem $filesystem
26+
* @param \Magento\Framework\View\Asset\Repository $assetRepo
27+
* @param \Magento\Framework\Less\File\Temporary $temporaryFile
28+
* @param \Magento\Framework\App\View\Asset\Publisher $publisher
29+
*/
30+
public function __construct(
31+
\Magento\Framework\Filesystem $filesystem,
32+
\Magento\Framework\View\Asset\Repository $assetRepo,
33+
\Magento\Framework\Less\File\Temporary $temporaryFile,
34+
\Magento\Framework\App\View\Asset\Publisher $publisher
35+
) {
36+
parent::__construct($filesystem, $assetRepo, $temporaryFile);
37+
$this->publisher = $publisher;
38+
}
39+
40+
/**
41+
* {inheritdoc}
42+
*/
43+
protected function generateRelatedFile($relatedFileId, LocalInterface $asset)
44+
{
45+
$relatedAsset = parent::generateRelatedFile($relatedFileId, $asset);
46+
$this->publisher->publish($relatedAsset);
47+
return $relatedAsset;
48+
}
49+
}

app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Sales\Model\Order\Email\Sender\ShipmentSender;
1010
use Magento\Backend\App\Action;
11+
use Magento\Framework\View\Result\LayoutFactory;
1112

1213
class AddComment extends \Magento\Backend\App\Action
1314
{
@@ -21,18 +22,26 @@ class AddComment extends \Magento\Backend\App\Action
2122
*/
2223
protected $shipmentSender;
2324

25+
/**
26+
* @var LayoutFactory
27+
*/
28+
protected $resultLayoutFactory;
29+
2430
/**
2531
* @param Action\Context $context
2632
* @param \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader
2733
* @param ShipmentSender $shipmentSender
34+
* @param LayoutFactory $resultLayoutFactory
2835
*/
2936
public function __construct(
3037
Action\Context $context,
3138
\Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader,
32-
ShipmentSender $shipmentSender
39+
ShipmentSender $shipmentSender,
40+
LayoutFactory $resultLayoutFactory
3341
) {
3442
$this->shipmentLoader = $shipmentLoader;
3543
$this->shipmentSender = $shipmentSender;
44+
$this->resultLayoutFactory = $resultLayoutFactory;
3645
parent::__construct($context);
3746
}
3847

@@ -72,10 +81,9 @@ public function execute()
7281

7382
$this->shipmentSender->send($shipment, !empty($data['is_customer_notified']), $data['comment']);
7483
$shipment->save();
75-
76-
$this->_view->loadLayout(false);
77-
$this->_view->getPage()->getConfig()->getTitle()->prepend(__('Shipments'));
78-
$response = $this->_view->getLayout()->getBlock('shipment_comments')->toHtml();
84+
$resultLayout = $this->resultLayoutFactory->create();
85+
$resultLayout->addDefaultHandle();
86+
$response = $resultLayout->getLayout()->getBlock('shipment_comments')->toHtml();
7987
} catch (\Magento\Framework\Exception\LocalizedException $e) {
8088
$response = ['error' => true, 'message' => $e->getMessage()];
8189
} catch (\Exception $e) {

0 commit comments

Comments
 (0)