Skip to content

Commit 42d4e1b

Browse files
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into MAGETWO-90563
2 parents e2ae3b6 + a902370 commit 42d4e1b

File tree

9 files changed

+67
-11
lines changed

9 files changed

+67
-11
lines changed

app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<?= $block->escapeHtml($block->getName()) ?><br>
2121
<?= $block->escapeHtml($block->getCustomer()->getEmail()) ?><br>
2222
</p>
23+
<?= $block->getChildHtml('customer.account.dashboard.info.extra'); ?>
2324
</div>
2425
<div class="box-actions">
2526
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('customer/account/edit')) ?>">
@@ -43,8 +44,6 @@
4344
<?= $block->escapeHtml(__('You aren\'t subscribed to our newsletter.')) ?>
4445
<?php endif; ?>
4546
</p>
46-
<?php /* Extensions placeholder */ ?>
47-
<?= $block->getChildHtml('customer.account.dashboard.info.extra') ?>
4847
</div>
4948
<div class="box-actions">
5049
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('newsletter/manage')) ?>"><span><?= $block->escapeHtml(__('Edit')) ?></span></a>

app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\Config\File\ConfigFilePool;
1313
use Magento\Framework\Console\Cli;
1414
use Symfony\Component\Console\Command\Command;
15+
use Symfony\Component\Console\Input\InputArgument;
1516
use Symfony\Component\Console\Input\InputInterface;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718

@@ -20,6 +21,8 @@
2021
*/
2122
class ApplicationDumpCommand extends Command
2223
{
24+
const INPUT_CONFIG_TYPES = 'config-types';
25+
2326
/**
2427
* @var Writer
2528
*/
@@ -47,10 +50,10 @@ public function __construct(
4750
array $sources,
4851
Hash $configHash = null
4952
) {
50-
parent::__construct();
5153
$this->writer = $writer;
5254
$this->sources = $sources;
5355
$this->configHash = $configHash ?: ObjectManager::getInstance()->get(Hash::class);
56+
parent::__construct();
5457
}
5558

5659
/**
@@ -60,6 +63,13 @@ protected function configure()
6063
{
6164
$this->setName('app:config:dump');
6265
$this->setDescription('Create dump of application');
66+
67+
$configTypes = array_unique(array_column($this->sources, 'namespace'));
68+
$this->addArgument(
69+
self::INPUT_CONFIG_TYPES,
70+
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
71+
sprintf('Space-separated list of config types or omit to dump all [%s]', implode(', ', $configTypes))
72+
);
6373
parent::configure();
6474
}
6575

@@ -74,11 +84,14 @@ protected function configure()
7484
protected function execute(InputInterface $input, OutputInterface $output)
7585
{
7686
$this->groupSourcesByPool();
77-
87+
$dumpedTypes = [];
7888
foreach ($this->sources as $pool => $sources) {
7989
$dump = [];
8090
$comments = [];
8191
foreach ($sources as $sourceData) {
92+
if ($this->skipDump($input, $sourceData)) {
93+
continue;
94+
}
8295
/** @var ConfigSourceInterface $source */
8396
$source = $sourceData['source'];
8497
$namespace = $sourceData['namespace'];
@@ -95,15 +108,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
95108
null,
96109
$comments
97110
);
111+
$dumpedTypes = array_unique($dumpedTypes + array_keys($dump));
98112
if (!empty($comments)) {
99113
$output->writeln($comments);
100114
}
101115
}
102116

117+
if (!$dumpedTypes) {
118+
$output->writeln('<error>Nothing dumped. Check the config types specified and try again');
119+
return Cli::RETURN_FAILURE;
120+
}
121+
103122
// Generate and save new hash of deployment configuration.
104123
$this->configHash->regenerate();
105124

106-
$output->writeln('<info>Done.</info>');
125+
$output->writeln(sprintf('<info>Done. Config types dumped: %s</info>', implode(', ', $dumpedTypes)));
107126
return Cli::RETURN_SUCCESS;
108127
}
109128

@@ -127,4 +146,20 @@ private function groupSourcesByPool()
127146

128147
$this->sources = $sources;
129148
}
149+
150+
/**
151+
* Check whether the dump source should be skipped
152+
*
153+
* @param InputInterface $input
154+
* @param array $sourceData
155+
* @return bool
156+
*/
157+
private function skipDump(InputInterface $input, array $sourceData): bool
158+
{
159+
$allowedTypes = $input->getArgument(self::INPUT_CONFIG_TYPES);
160+
if ($allowedTypes && !in_array($sourceData['namespace'], $allowedTypes)) {
161+
return true;
162+
}
163+
return false;
164+
}
130165
}

app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function testExport()
130130
->method('writeln')
131131
->withConsecutive(
132132
[['system' => 'Some comment message']],
133-
['<info>Done.</info>']
133+
['<info>Done. Config types dumped: system</info>']
134134
);
135135

136136
$method = new \ReflectionMethod(ApplicationDumpCommand::class, 'execute');

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Observer
1919

2020
/**
2121
* Cronjob expression configuration
22+
*
23+
* @deprecated Use \Magento\Cron\Model\Config\Backend\Sitemap::CRON_STRING_PATH instead.
2224
*/
2325
const XML_PATH_CRON_EXPR = 'crontab/default/jobs/generate_sitemaps/schedule/cron_expr';
2426

app/code/Magento/Sitemap/etc/config.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,16 @@
4242
</valid_paths>
4343
</file>
4444
</sitemap>
45+
<crontab>
46+
<default>
47+
<jobs>
48+
<sitemap_generate>
49+
<schedule>
50+
<cron_expr>0 0 * * *</cron_expr>
51+
</schedule>
52+
</sitemap_generate>
53+
</jobs>
54+
</default>
55+
</crontab>
4556
</default>
4657
</config>

app/code/Magento/User/Model/User.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class User extends AbstractModel implements StorageInterface, UserInterface
4848
/** @deprecated */
4949
const XML_PATH_RESET_PASSWORD_TEMPLATE = 'admin/emails/reset_password_template';
5050

51+
const MESSAGE_ID_PASSWORD_EXPIRED = 'magento_user_password_expired';
52+
5153
/**
5254
* Model event prefix
5355
*

app/code/Magento/User/Observer/Backend/AuthObserver.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function execute(EventObserver $observer)
152152
/**
153153
* Update locking information for the user
154154
*
155-
* @param \Magento\User\Model\User $user
155+
* @param User $user
156156
* @return void
157157
*/
158158
private function _updateLockingInformation($user)
@@ -198,10 +198,16 @@ private function _checkExpiredPassword($latestPassword)
198198
$myAccountUrl = $this->url->getUrl('adminhtml/system_account/');
199199
$message = __('It\'s time to <a href="%1">change your password</a>.', $myAccountUrl);
200200
}
201+
202+
$messages = $this->messageManager->getMessages();
203+
204+
// Remove existing messages with same ID to avoid duplication
205+
$messages->deleteMessageByIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED);
206+
201207
$this->messageManager->addNoticeMessage($message);
202-
$message = $this->messageManager->getMessages()->getLastAddedMessage();
208+
$message = $messages->getLastAddedMessage();
203209
if ($message) {
204-
$message->setIdentifier('magento_user_password_expired')->setIsSticky(true);
210+
$message->setIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED)->setIsSticky(true);
205211
$this->authSession->setPciAdminUserIsPasswordExpired(true);
206212
}
207213
}

app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Framework\Event\Observer as EventObserver;
1010
use Magento\Framework\Event\ObserverInterface;
11+
use Magento\User\Model\User;
1112

1213
/**
1314
* User backend observer model for passwords
@@ -74,7 +75,7 @@ public function execute(EventObserver $observer)
7475
$passwordHash = $user->getPassword();
7576
if ($passwordHash && !$user->getForceNewPassword()) {
7677
$this->userResource->trackPassword($user, $passwordHash);
77-
$this->messageManager->getMessages()->deleteMessageByIdentifier('magento_user_password_expired');
78+
$this->messageManager->getMessages()->deleteMessageByIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED);
7879
$this->authSession->unsPciAdminUserIsPasswordExpired();
7980
}
8081
}

dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function testExecute()
176176
->with(['system' => $comment]);
177177
$outputMock->expects($this->at(1))
178178
->method('writeln')
179-
->with('<info>Done.</info>');
179+
->with($this->matchesRegularExpression('/<info>Done. Config types dumped: [a-z0-9,\s]+<\/info>/'));
180180

181181
/** @var ApplicationDumpCommand command */
182182
$command = $this->objectManager->create(ApplicationDumpCommand::class);

0 commit comments

Comments
 (0)