Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov committed Dec 11, 2017
1 parent e9ba7eb commit 491ed56
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/internal/Magento/Framework/Crontab/CrontabManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ public function removeTasks()
private function generateSection($content, $tasks = [])
{
if ($tasks) {
$content .= PHP_EOL . self::TASKS_BLOCK_START . PHP_EOL;
// Add EOL symbol to previous line if not exist.
if (substr($content, -strlen(PHP_EOL)) !== PHP_EOL) {
$content .= PHP_EOL;
}

$content .= self::TASKS_BLOCK_START . PHP_EOL;
foreach ($tasks as $task) {
$content .= $task['expression'] . ' ' . PHP_BINARY . ' '. $task['command'] . PHP_EOL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ public function saveTasksDataProvider()
. ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"' . PHP_EOL
. CrontabManagerInterface::TASKS_BLOCK_END . PHP_EOL,
],
[
'tasks' => [
['command' => '{magentoRoot}run.php % cron:run | grep -v "Ran \'jobs\' by schedule"']
],
'content' => '* * * * * /bin/php /var/www/cron.php',
'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
. CrontabManagerInterface::TASKS_BLOCK_START . PHP_EOL
. '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php'
. ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"' . PHP_EOL
. CrontabManagerInterface::TASKS_BLOCK_END . PHP_EOL,
],
];
}
}

0 comments on commit 491ed56

Please sign in to comment.