11 use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory;
12 use Symfony\Component\Console\Command\Command;
13 use Symfony\Component\Console\Input\InputInterface;
14 use Symfony\Component\Console\Output\OutputInterface;
21 private $customerCollectionFactory;
38 CollectionFactory $customerCollectionFactory,
41 parent::__construct();
42 $this->customerCollectionFactory = $customerCollectionFactory;
51 $this->setName(
'customer:hash:upgrade')
52 ->setDescription(
'Upgrade customer\'s hash according to the latest algorithm');
58 protected function execute(InputInterface $input, OutputInterface
$output)
60 $this->collection = $this->customerCollectionFactory->create();
61 $this->collection->addAttributeToSelect(
'*');
62 $customerCollection = $this->collection->getItems();
64 foreach ($customerCollection as
$customer) {
66 if (!$this->encryptor->validateHashVersion(
$customer->getPasswordHash())) {
75 $output->writeln(
"<info>Finished</info>");
__construct(CollectionFactory $customerCollectionFactory, Encryptor $encryptor)
const HASH_VERSION_LATEST