![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/magento/module-catalog-rule/Cron/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\CatalogRule\Cron; use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor; use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory as RuleCollectionFactory; /** * Daily update catalog price rule by cron */ class DailyCatalogUpdate { /** * @var RuleProductProcessor */ protected $ruleProductProcessor; /** * @var RuleCollectionFactory */ private $ruleCollectionFactory; /** * @param RuleProductProcessor $ruleProductProcessor * @param RuleCollectionFactory $ruleCollectionFactory */ public function __construct( RuleProductProcessor $ruleProductProcessor, RuleCollectionFactory $ruleCollectionFactory ) { $this->ruleProductProcessor = $ruleProductProcessor; $this->ruleCollectionFactory = $ruleCollectionFactory; } /** * Daily update catalog price rule by cron * * Update include interval 3 days - current day - 1 days before + 1 days after * This method is called from cron process, cron is working in UTC time and * we should generate data for interval -1 day ... +1 day * * @return void */ public function execute() { $ruleCollection = $this->ruleCollectionFactory->create(); $ruleCollection->addIsActiveFilter(); if ($ruleCollection->getSize()) { $this->ruleProductProcessor->markIndexerAsInvalid(); } } }