moduleDataSetup = $moduleDataSetup; $this->configWriter = $configWriter; } /** * {@inheritdoc} */ public function apply() { $this->moduleDataSetup->startSetup(); $cronExpression = $this->_generateCronExpression(); $this->configWriter->save(self::UPDATE_CRON_STRING_PATH, $cronExpression); $this->moduleDataSetup->endSetup(); } /** * {@inheritdoc} */ public static function getVersion() { return '1.1.1'; } /** * @inheritdoc */ public function getAliases() { return []; } /** * @inheritdoc */ public static function getDependencies() { return []; } /** * @return string */ protected function _generateCronExpression() { $minute = rand(0, 59); $hour = rand(-2, 6); $dayOfWeek = rand(0, 6); if ($hour < 0) { $hour += 24; } return $minute . ' ' . $hour . ' * * ' . $dayOfWeek; } }