Display the next run time of tasks
This commit is contained in:
@@ -42,7 +42,7 @@ class ScheduleListCommand extends BaseCommand
|
|||||||
unset($task['instance']);
|
unset($task['instance']);
|
||||||
return $task;
|
return $task;
|
||||||
}, $tasks);
|
}, $tasks);
|
||||||
$this->io->table(['Schedule', 'Sprinkle', 'Name', 'Namespace'], $tasks);
|
$this->io->table(['Schedule', 'Sprinkle', 'Name', 'Namespace', 'Next Run'], $tasks);
|
||||||
|
|
||||||
return self::SUCCESS;
|
return self::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ abstract class BaseTask implements TaskInterface
|
|||||||
*/
|
*/
|
||||||
public function nextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false)
|
public function nextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false)
|
||||||
{
|
{
|
||||||
return Date::instance((new CronExpression($this->getExpression()))
|
return Date::instance((new CronExpression($this->expression))
|
||||||
->getNextRunDate($currentTime, $nth, $allowCurrentDate, $this->timezone));
|
->getNextRunDate($currentTime, $nth, $allowCurrentDate, $this->timezone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ class Scheduler
|
|||||||
|
|
||||||
$schedule = $taskClass->cronExpression();
|
$schedule = $taskClass->cronExpression();
|
||||||
|
|
||||||
|
$nextRun = $taskClass->nextRunDate();
|
||||||
|
|
||||||
// Build the class name and namespace
|
// Build the class name and namespace
|
||||||
return [
|
return [
|
||||||
'schedule' => $schedule,
|
'schedule' => $schedule,
|
||||||
@@ -210,6 +212,7 @@ class Scheduler
|
|||||||
'name' => $name,
|
'name' => $name,
|
||||||
'class' => $classPath,
|
'class' => $classPath,
|
||||||
'instance' => $taskClass,
|
'instance' => $taskClass,
|
||||||
|
'next_run' => $nextRun,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user