DailyCatalogUpdate.php 1020 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\CatalogRule\Cron;
  7. class DailyCatalogUpdate
  8. {
  9. /**
  10. * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor
  11. */
  12. protected $ruleProductProcessor;
  13. /**
  14. * @param \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor $ruleProductProcessor
  15. */
  16. public function __construct(\Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor $ruleProductProcessor)
  17. {
  18. $this->ruleProductProcessor = $ruleProductProcessor;
  19. }
  20. /**
  21. * Daily update catalog price rule by cron
  22. * Update include interval 3 days - current day - 1 days before + 1 days after
  23. * This method is called from cron process, cron is working in UTC time and
  24. * we should generate data for interval -1 day ... +1 day
  25. *
  26. * @return void
  27. */
  28. public function execute()
  29. {
  30. $this->ruleProductProcessor->markIndexerAsInvalid();
  31. }
  32. }