13 class Cron extends \Magento\Framework\App\Config\Value
51 \
Magento\Framework\
App\Config\ValueFactory $configValueFactory,
53 \
Magento\Framework\Data\Collection\AbstractDb $resourceCollection =
null,
57 $this->_runModelPath = $runModelPath;
58 $this->_configValueFactory = $configValueFactory;
70 $enabled = $this->
getData(self::XML_PATH_BACKUP_ENABLED);
71 $time = $this->
getData(self::XML_PATH_BACKUP_TIME);
72 $frequency = $this->
getData(self::XML_PATH_BACKUP_FREQUENCY);
74 $frequencyWeekly = \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY;
75 $frequencyMonthly = \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY;
79 (int) $time[1], # Minute
80 (
int) $time[0], # Hour
81 $frequency == $frequencyMonthly ?
'1' :
'*', # Day of the Month
82 '*', # Month of the Year
83 $frequency == $frequencyWeekly ?
'1' :
'*', # Day of the Week
85 $cronExprString = join(
' ', $cronExprArray);
91 $this->_configValueFactory->create()->load(
92 self::CRON_STRING_PATH,
97 self::CRON_STRING_PATH
100 $this->_configValueFactory->create()->load(
101 self::CRON_MODEL_PATH,
106 self::CRON_MODEL_PATH
108 }
catch (\Exception $e) {
109 throw new \Magento\Framework\Exception\LocalizedException(
__(
'We can\'t save the Cron expression.'));
111 return parent::afterSave();
getData($key='', $index=null)
const XML_PATH_BACKUP_FREQUENCY
const XML_PATH_BACKUP_TIME
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\Framework\App\Config\ValueFactory $configValueFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, $runModelPath='', array $data=[])
const XML_PATH_BACKUP_ENABLED