Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #14957: Move customer.account.dashboard.info.extra block to contact information (by @JeroenVanLeusden)
 - #14908: [Forwardport] Add default schedule config for sitemap_generate job (by @rostyslav-hymon)
 - #14897: Fix issue #14895 - Change Password warning message appear two times (by @phoenix128)
 - #14807: [Forwardport] Add argument on app:config:dump to skip dumping all system settings. (by @ihor-sviziev)


Fixed GitHub Issues:
 - #5768: Magento 2.0.7 XML sitemap is not generated by schedule (reported by @dexterityzx) has been fixed in #14908 by @rostyslav-hymon in 2.3-develop branch
   Related commits:
     1. 0b85921
     2. 01f6fc2
     3. a324f86

 - #14895: Change Password warning message appear two times (reported by @cnviradiya) has been fixed in #14897 by @phoenix128 in 2.3-develop branch
   Related commits:
     1. 0abb682
     2. 8d8706e

 - #11396: app:config:dump locks every configuration setting no alternative to dump specific setting only (reported by @gulshan-streammarket) has been fixed in #14807 by @ihor-sviziev in 2.3-develop branch
   Related commits:
     1. 2631805
     2. 8bfbc77
     3. d3c53f8
     4. 0cbf318
  • Loading branch information
VladimirZaets authored May 4, 2018
2 parents 4988790 + 33e26f3 commit a902370
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<?= $block->escapeHtml($block->getName()) ?><br>
<?= $block->escapeHtml($block->getCustomer()->getEmail()) ?><br>
</p>
<?= $block->getChildHtml('customer.account.dashboard.info.extra'); ?>
</div>
<div class="box-actions">
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('customer/account/edit')) ?>">
Expand All @@ -43,8 +44,6 @@
<?= $block->escapeHtml(__('You aren\'t subscribed to our newsletter.')) ?>
<?php endif; ?>
</p>
<?php /* Extensions placeholder */ ?>
<?= $block->getChildHtml('customer.account.dashboard.info.extra') ?>
</div>
<div class="box-actions">
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('newsletter/manage')) ?>"><span><?= $block->escapeHtml(__('Edit')) ?></span></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Magento\Framework\Config\File\ConfigFilePool;
use Magento\Framework\Console\Cli;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand All @@ -20,6 +21,8 @@
*/
class ApplicationDumpCommand extends Command
{
const INPUT_CONFIG_TYPES = 'config-types';

/**
* @var Writer
*/
Expand Down Expand Up @@ -47,10 +50,10 @@ public function __construct(
array $sources,
Hash $configHash = null
) {
parent::__construct();
$this->writer = $writer;
$this->sources = $sources;
$this->configHash = $configHash ?: ObjectManager::getInstance()->get(Hash::class);
parent::__construct();
}

/**
Expand All @@ -60,6 +63,13 @@ protected function configure()
{
$this->setName('app:config:dump');
$this->setDescription('Create dump of application');

$configTypes = array_unique(array_column($this->sources, 'namespace'));
$this->addArgument(
self::INPUT_CONFIG_TYPES,
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
sprintf('Space-separated list of config types or omit to dump all [%s]', implode(', ', $configTypes))
);
parent::configure();
}

Expand All @@ -74,11 +84,14 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->groupSourcesByPool();

$dumpedTypes = [];
foreach ($this->sources as $pool => $sources) {
$dump = [];
$comments = [];
foreach ($sources as $sourceData) {
if ($this->skipDump($input, $sourceData)) {
continue;
}
/** @var ConfigSourceInterface $source */
$source = $sourceData['source'];
$namespace = $sourceData['namespace'];
Expand All @@ -95,15 +108,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
null,
$comments
);
$dumpedTypes = array_unique($dumpedTypes + array_keys($dump));
if (!empty($comments)) {
$output->writeln($comments);
}
}

if (!$dumpedTypes) {
$output->writeln('<error>Nothing dumped. Check the config types specified and try again');
return Cli::RETURN_FAILURE;
}

// Generate and save new hash of deployment configuration.
$this->configHash->regenerate();

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

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

$this->sources = $sources;
}

/**
* Check whether the dump source should be skipped
*
* @param InputInterface $input
* @param array $sourceData
* @return bool
*/
private function skipDump(InputInterface $input, array $sourceData): bool
{
$allowedTypes = $input->getArgument(self::INPUT_CONFIG_TYPES);
if ($allowedTypes && !in_array($sourceData['namespace'], $allowedTypes)) {
return true;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function testExport()
->method('writeln')
->withConsecutive(
[['system' => 'Some comment message']],
['<info>Done.</info>']
['<info>Done. Config types dumped: system</info>']
);

$method = new \ReflectionMethod(ApplicationDumpCommand::class, 'execute');
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Sitemap/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Observer

/**
* Cronjob expression configuration
*
* @deprecated Use \Magento\Cron\Model\Config\Backend\Sitemap::CRON_STRING_PATH instead.
*/
const XML_PATH_CRON_EXPR = 'crontab/default/jobs/generate_sitemaps/schedule/cron_expr';

Expand Down
11 changes: 11 additions & 0 deletions app/code/Magento/Sitemap/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,16 @@
</valid_paths>
</file>
</sitemap>
<crontab>
<default>
<jobs>
<sitemap_generate>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
</schedule>
</sitemap_generate>
</jobs>
</default>
</crontab>
</default>
</config>
2 changes: 2 additions & 0 deletions app/code/Magento/User/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class User extends AbstractModel implements StorageInterface, UserInterface
/** @deprecated */
const XML_PATH_RESET_PASSWORD_TEMPLATE = 'admin/emails/reset_password_template';

const MESSAGE_ID_PASSWORD_EXPIRED = 'magento_user_password_expired';

/**
* Model event prefix
*
Expand Down
12 changes: 9 additions & 3 deletions app/code/Magento/User/Observer/Backend/AuthObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function execute(EventObserver $observer)
/**
* Update locking information for the user
*
* @param \Magento\User\Model\User $user
* @param User $user
* @return void
*/
private function _updateLockingInformation($user)
Expand Down Expand Up @@ -198,10 +198,16 @@ private function _checkExpiredPassword($latestPassword)
$myAccountUrl = $this->url->getUrl('adminhtml/system_account/');
$message = __('It\'s time to <a href="%1">change your password</a>.', $myAccountUrl);
}

$messages = $this->messageManager->getMessages();

// Remove existing messages with same ID to avoid duplication
$messages->deleteMessageByIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED);

$this->messageManager->addNoticeMessage($message);
$message = $this->messageManager->getMessages()->getLastAddedMessage();
$message = $messages->getLastAddedMessage();
if ($message) {
$message->setIdentifier('magento_user_password_expired')->setIsSticky(true);
$message->setIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED)->setIsSticky(true);
$this->authSession->setPciAdminUserIsPasswordExpired(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Magento\Framework\Event\Observer as EventObserver;
use Magento\Framework\Event\ObserverInterface;
use Magento\User\Model\User;

/**
* User backend observer model for passwords
Expand Down Expand Up @@ -74,7 +75,7 @@ public function execute(EventObserver $observer)
$passwordHash = $user->getPassword();
if ($passwordHash && !$user->getForceNewPassword()) {
$this->userResource->trackPassword($user, $passwordHash);
$this->messageManager->getMessages()->deleteMessageByIdentifier('magento_user_password_expired');
$this->messageManager->getMessages()->deleteMessageByIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED);
$this->authSession->unsPciAdminUserIsPasswordExpired();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function testExecute()
->with(['system' => $comment]);
$outputMock->expects($this->at(1))
->method('writeln')
->with('<info>Done.</info>');
->with($this->matchesRegularExpression('/<info>Done. Config types dumped: [a-z0-9,\s]+<\/info>/'));

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

0 comments on commit a902370

Please sign in to comment.