Skip to content

Commit

Permalink
Merge pull request #1830 from magento-engcom/develop-prs
Browse files Browse the repository at this point in the history
Public Pull Requests
#12609 Update CrontabManager.php by @WaPoNe
  • Loading branch information
Oleksii Korshenko authored Dec 11, 2017
2 parents a6f3e1d + 657d4a3 commit 5d10ddd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/internal/Magento/Framework/Crontab/CrontabManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public function removeTasks()
private function generateSection($content, $tasks = [])
{
if ($tasks) {
// Add EOL symbol to previous line if not exist.
if (substr($content, -strlen(PHP_EOL)) !== PHP_EOL) {
$content .= PHP_EOL;
}

$content .= $this->getTasksBlockStart() . 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 @@ -338,6 +338,17 @@ public function saveTasksDataProvider()
. ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"' . PHP_EOL
. CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . 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 . ' ' . md5(BP) . PHP_EOL
. '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php'
. ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"' . PHP_EOL
. CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
],
];
}
}

0 comments on commit 5d10ddd

Please sign in to comment.