Skip to content

Commit 4f6de51

Browse files
author
Stanislav Idolov
committed
Merge remote-tracking branch 'mainline/develop' into literal_classname_to_namespace
2 parents f171da3 + ffd9cc6 commit 4f6de51

File tree

41 files changed

+1026
-250
lines changed

Some content is hidden

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

41 files changed

+1026
-250
lines changed

.htaccess

-30
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,6 @@
3232

3333
DirectoryIndex index.php
3434

35-
<IfModule mod_php5.c>
36-
37-
############################################
38-
## adjust memory limit
39-
40-
php_value memory_limit 768M
41-
php_value max_execution_time 18000
42-
43-
############################################
44-
## disable automatic session start
45-
## before autoload was initialized
46-
47-
php_flag session.auto_start off
48-
49-
############################################
50-
## enable resulting html compression
51-
52-
#php_flag zlib.output_compression on
53-
54-
###########################################
55-
## disable user agent verification to not break multiple image upload
56-
57-
php_flag suhosin.session.cryptua off
58-
59-
</IfModule>
60-
61-
<IfModule mod_php7.c>
62-
6335
############################################
6436
## adjust memory limit
6537

@@ -82,8 +54,6 @@
8254

8355
php_flag suhosin.session.cryptua off
8456

85-
</IfModule>
86-
8757
<IfModule mod_security.c>
8858
###########################################
8959
## disable POST processing to not break multiple image upload

.htaccess.sample

-30
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,6 @@
3232

3333
DirectoryIndex index.php
3434

35-
<IfModule mod_php5.c>
36-
37-
############################################
38-
## adjust memory limit
39-
40-
php_value memory_limit 768M
41-
php_value max_execution_time 18000
42-
43-
############################################
44-
## disable automatic session start
45-
## before autoload was initialized
46-
47-
php_flag session.auto_start off
48-
49-
############################################
50-
## enable resulting html compression
51-
52-
#php_flag zlib.output_compression on
53-
54-
###########################################
55-
## disable user agent verification to not break multiple image upload
56-
57-
php_flag suhosin.session.cryptua off
58-
59-
</IfModule>
60-
61-
<IfModule mod_php7.c>
62-
6335
############################################
6436
## adjust memory limit
6537

@@ -82,8 +54,6 @@
8254

8355
php_flag suhosin.session.cryptua off
8456

85-
</IfModule>
86-
8757
<IfModule mod_security.c>
8858
###########################################
8959
## disable POST processing to not break multiple image upload

app/code/Magento/Backup/Cron/SystemBackup.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public function __construct(
9797
* Create Backup
9898
*
9999
* @return $this
100+
* @throws \Exception
100101
*/
101102
public function execute()
102103
{
@@ -138,8 +139,7 @@ public function execute()
138139
} catch (\Exception $e) {
139140
$this->_errors[] = $e->getMessage();
140141
$this->_errors[] = $e->getTrace();
141-
$this->_logger->info($e->getMessage());
142-
$this->_logger->critical($e);
142+
throw $e;
143143
}
144144

145145
if ($this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE, ScopeInterface::SCOPE_STORE)) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Backup\Test\Unit\Cron;
7+
8+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
9+
10+
class SystemBackupTest extends \PHPUnit_Framework_TestCase
11+
{
12+
/**
13+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
14+
*/
15+
private $objectManager;
16+
17+
/**
18+
* @var \Magento\Backup\Cron\SystemBackup
19+
*/
20+
private $systemBackup;
21+
22+
/**
23+
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
24+
*/
25+
private $scopeConfigMock;
26+
27+
/**
28+
* @var \Magento\Backup\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $backupDataMock;
31+
32+
/**
33+
* @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject
34+
*/
35+
private $registryMock;
36+
37+
/**
38+
* @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
39+
*/
40+
private $loggerMock;
41+
42+
/**
43+
* Filesystem facade
44+
*
45+
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
46+
*/
47+
private $filesystemMock;
48+
49+
/**
50+
* @var \Magento\Framework\Backup\Factory|\PHPUnit_Framework_MockObject_MockObject
51+
*/
52+
private $backupFactoryMock;
53+
54+
/**
55+
* @var \Magento\Framework\App\MaintenanceMode|\PHPUnit_Framework_MockObject_MockObject
56+
*/
57+
private $maintenanceModeMock;
58+
59+
/**
60+
* @var \Magento\Framework\Backup\Db|\PHPUnit_Framework_MockObject_MockObject
61+
*/
62+
private $backupDbMock;
63+
64+
/**
65+
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
66+
*/
67+
private $objectManagerMock;
68+
69+
protected function setUp()
70+
{
71+
$this->objectManagerMock = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class)
72+
->getMock();
73+
$this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
74+
->getMock();
75+
$this->backupDataMock = $this->getMockBuilder(\Magento\Backup\Helper\Data::class)
76+
->disableOriginalConstructor()
77+
->getMock();
78+
$this->registryMock = $this->getMockBuilder(\Magento\Framework\Registry::class)
79+
->disableOriginalConstructor()
80+
->getMock();
81+
$this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
82+
->getMock();
83+
$this->filesystemMock = $this->getMockBuilder(\Magento\Framework\Filesystem::class)
84+
->disableOriginalConstructor()
85+
->getMock();
86+
$this->backupFactoryMock = $this->getMockBuilder(\Magento\Framework\Backup\Factory::class)
87+
->disableOriginalConstructor()
88+
->getMock();
89+
$this->maintenanceModeMock = $this->getMockBuilder(\Magento\Framework\App\MaintenanceMode::class)
90+
->disableOriginalConstructor()
91+
->getMock();
92+
93+
$this->backupDbMock = $this->getMockBuilder(\Magento\Framework\Backup\Db::class)
94+
->disableOriginalConstructor()
95+
->getMock();
96+
$this->backupDbMock->expects($this->any())->method('setBackupExtension')->willReturnSelf();
97+
$this->backupDbMock->expects($this->any())->method('setTime')->willReturnSelf();
98+
$this->backupDbMock->expects($this->any())->method('setBackupsDir')->willReturnSelf();
99+
100+
$this->objectManager = new ObjectManager($this);
101+
$this->systemBackup = $this->objectManager->getObject(
102+
\Magento\Backup\Cron\SystemBackup::class,
103+
[
104+
'backupData' => $this->backupDataMock,
105+
'coreRegistry' => $this->registryMock,
106+
'logger' => $this->loggerMock,
107+
'scopeConfig' => $this->scopeConfigMock,
108+
'filesystem' => $this->filesystemMock,
109+
'backupFactory' => $this->backupFactoryMock,
110+
'maintenanceMode' => $this->maintenanceModeMock,
111+
]
112+
);
113+
}
114+
115+
/**
116+
* @expectedException \Exception
117+
*/
118+
public function testExecuteThrowsException()
119+
{
120+
$type = 'db';
121+
$this->scopeConfigMock->expects($this->any())->method('isSetFlag')->willReturn(true);
122+
123+
$this->scopeConfigMock->expects($this->once())->method('getValue')
124+
->with('system/backup/type', 'store')
125+
->willReturn($type);
126+
127+
$this->backupFactoryMock->expects($this->once())->method('create')->willReturn($this->backupDbMock);
128+
129+
$this->backupDbMock->expects($this->once())->method('create')->willThrowException(new \Exception);
130+
131+
$this->backupDataMock->expects($this->never())->method('getCreateSuccessMessageByType')->with($type);
132+
$this->loggerMock->expects($this->never())->method('info');
133+
134+
$this->systemBackup->execute();
135+
}
136+
}

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

+1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ protected function getBundleOptions()
303303
'data' => [
304304
'config' => [
305305
'componentType' => 'fieldset',
306+
'collapsible' => true,
306307
'label' => '',
307308
'opened' => true,
308309
],

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php

+1
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ protected function getOptionsGridConfig($sortOrder)
386386
'data' => [
387387
'config' => [
388388
'componentType' => Fieldset::NAME,
389+
'collapsible' => true,
389390
'label' => null,
390391
'sortOrder' => 10,
391392
'opened' => true,

app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- ko text: currentBillingAddress().prefix --><!-- /ko --> <!-- ko text: currentBillingAddress().firstname --><!-- /ko -->
99
<!-- ko text: currentBillingAddress().lastname --><!-- /ko --> <!-- ko text: currentBillingAddress().suffix --><!-- /ko --><br/>
1010
<!-- ko text: currentBillingAddress().street --><!-- /ko --><br/>
11-
<!-- ko text: currentBillingAddress().city --><!-- /ko -->, <!-- ko text: currentBillingAddress().region --><!-- /ko --> <!-- ko text: currentBillingAddress().postcode --><!-- /ko --><br/>
11+
<!-- ko text: currentBillingAddress().city --><!-- /ko -->, <span data-bind="html: currentBillingAddress().region"></span> <!-- ko text: currentBillingAddress().postcode --><!-- /ko --><br/>
1212
<!-- ko text: getCountryName(currentBillingAddress().countryId) --><!-- /ko --><br/>
1313
<!-- ko if: (currentBillingAddress().telephone) -->
1414
<a data-bind="text: currentBillingAddress().telephone, attr: {'href': 'tel:' + currentBillingAddress().telephone}"></a>

app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko -->
99
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
1010
<!-- ko text: address().street --><!-- /ko --><br/>
11-
<!-- ko text: address().city --><!-- /ko -->, <!-- ko text: address().region --><!-- /ko --> <!-- ko text: address().postcode --><!-- /ko --><br/>
11+
<!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>
1212
<!-- ko text: getCountryName(address().countryId) --><!-- /ko --><br/>
1313
<!-- ko if: (address().telephone) -->
1414
<a data-bind="text: address().telephone, attr: {'href': 'tel:' + address().telephone}"></a>

app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko -->
99
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
1010
<!-- ko text: address().street --><!-- /ko --><br/>
11-
<!-- ko text: address().city --><!-- /ko -->, <!-- ko text: address().region --><!-- /ko --> <!-- ko text: address().postcode --><!-- /ko --><br/>
11+
<!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>
1212
<!-- ko text: getCountryName(address().countryId) --><!-- /ko --><br/>
1313
<!-- ko if: (address().telephone) -->
1414
<a data-bind="text: address().telephone, attr: {'href': 'tel:' + address().telephone}"></a>

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

+35-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace Magento\Cron\Observer;
1111

12+
use Magento\Framework\App\State;
1213
use Magento\Framework\Console\CLI;
1314
use Magento\Framework\Event\ObserverInterface;
1415
use \Magento\Cron\Model\Schedule;
@@ -105,16 +106,28 @@ class ProcessCronQueueObserver implements ObserverInterface
105106
*/
106107
protected $phpExecutableFinder;
107108

109+
/**
110+
* @var \Psr\Log\LoggerInterface
111+
*/
112+
private $logger;
113+
114+
/**
115+
* @var \Magento\Framework\App\State
116+
*/
117+
private $state;
118+
108119
/**
109120
* @param \Magento\Framework\ObjectManagerInterface $objectManager
110-
* @param ScheduleFactory $scheduleFactory
121+
* @param \Magento\Cron\Model\ScheduleFactory $scheduleFactory
111122
* @param \Magento\Framework\App\CacheInterface $cache
112-
* @param ConfigInterface $config
123+
* @param \Magento\Cron\Model\ConfigInterface $config
113124
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
114125
* @param \Magento\Framework\App\Console\Request $request
115126
* @param \Magento\Framework\ShellInterface $shell
116127
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
117128
* @param \Magento\Framework\Process\PhpExecutableFinderFactory $phpExecutableFinderFactory
129+
* @param \Psr\Log\LoggerInterface $logger
130+
* @param \Magento\Framework\App\State $state
118131
*/
119132
public function __construct(
120133
\Magento\Framework\ObjectManagerInterface $objectManager,
@@ -125,7 +138,9 @@ public function __construct(
125138
\Magento\Framework\App\Console\Request $request,
126139
\Magento\Framework\ShellInterface $shell,
127140
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone,
128-
\Magento\Framework\Process\PhpExecutableFinderFactory $phpExecutableFinderFactory
141+
\Magento\Framework\Process\PhpExecutableFinderFactory $phpExecutableFinderFactory,
142+
\Psr\Log\LoggerInterface $logger,
143+
\Magento\Framework\App\State $state
129144
) {
130145
$this->_objectManager = $objectManager;
131146
$this->_scheduleFactory = $scheduleFactory;
@@ -136,6 +151,8 @@ public function __construct(
136151
$this->_shell = $shell;
137152
$this->timezone = $timezone;
138153
$this->phpExecutableFinder = $phpExecutableFinderFactory->create();
154+
$this->logger = $logger;
155+
$this->state = $state;
139156
}
140157

141158
/**
@@ -196,6 +213,21 @@ public function execute(\Magento\Framework\Event\Observer $observer)
196213
}
197214
} catch (\Exception $e) {
198215
$schedule->setMessages($e->getMessage());
216+
if ($schedule->getStatus() === Schedule::STATUS_ERROR) {
217+
$this->logger->critical($e);
218+
}
219+
if ($schedule->getStatus() === Schedule::STATUS_MISSED
220+
&& $this->state->getMode() === State::MODE_DEVELOPER
221+
) {
222+
$this->logger->info(
223+
sprintf(
224+
"%s Schedule Id: %s Job Code: %s",
225+
$schedule->getMessages(),
226+
$schedule->getScheduleId(),
227+
$schedule->getJobCode()
228+
)
229+
);
230+
}
199231
}
200232
$schedule->save();
201233
}

0 commit comments

Comments
 (0)