File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
lib/internal/Magento/Framework/Crontab Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,12 @@ public function removeTasks()
114114 private function generateSection ($ content , $ tasks = [])
115115 {
116116 if ($ tasks ) {
117- $ content .= PHP_EOL . self ::TASKS_BLOCK_START . PHP_EOL ;
117+ // Add EOL symbol to previous line if not exist.
118+ if (substr ($ content , -strlen (PHP_EOL )) !== PHP_EOL ) {
119+ $ content .= PHP_EOL ;
120+ }
121+
122+ $ content .= self ::TASKS_BLOCK_START . PHP_EOL ;
118123 foreach ($ tasks as $ task ) {
119124 $ content .= $ task ['expression ' ] . ' ' . PHP_BINARY . ' ' . $ task ['command ' ] . PHP_EOL ;
120125 }
Original file line number Diff line number Diff line change @@ -339,6 +339,17 @@ public function saveTasksDataProvider()
339339 . ' %% cron:run | grep -v \"Ran \'jobs \' by schedule\" ' . PHP_EOL
340340 . CrontabManagerInterface::TASKS_BLOCK_END . PHP_EOL ,
341341 ],
342+ [
343+ 'tasks ' => [
344+ ['command ' => '{magentoRoot}run.php % cron:run | grep -v "Ran \'jobs \' by schedule" ' ]
345+ ],
346+ 'content ' => '* * * * * /bin/php /var/www/cron.php ' ,
347+ 'contentToSave ' => '* * * * * /bin/php /var/www/cron.php ' . PHP_EOL
348+ . CrontabManagerInterface::TASKS_BLOCK_START . PHP_EOL
349+ . '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php '
350+ . ' %% cron:run | grep -v \"Ran \'jobs \' by schedule\" ' . PHP_EOL
351+ . CrontabManagerInterface::TASKS_BLOCK_END . PHP_EOL ,
352+ ],
342353 ];
343354 }
344355}
You can’t perform that action at this time.
0 commit comments