diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-01-10 18:20:31 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-01-10 18:20:31 +0100 |
commit | 679682c186ee99c98fe795721b5e620e03d96d6b (patch) | |
tree | 18d34b213b8bb2aa28d40d01e41474c717844822 /core | |
parent | 4ecf4b46422b9245599651ccd9c4de7f943aa359 (diff) | |
download | nextcloud-server-679682c186ee99c98fe795721b5e620e03d96d6b.tar.gz nextcloud-server-679682c186ee99c98fe795721b5e620e03d96d6b.zip |
Use a Generator for job list to fix background-job:list command
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/Background/ListCommand.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index bdd45f3a25f..30440b226de 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -72,15 +72,16 @@ class ListCommand extends Base { return 0; } - protected function formatJobs(array $jobs): array { - return array_map( - fn ($job) => [ + protected function formatJobs(iterable $jobs): array { + $jobsInfo = []; + foreach ($jobs as $job) { + $jobsInfo[] = [ 'id' => $job->getId(), 'class' => get_class($job), 'last_run' => date(DATE_ATOM, $job->getLastRun()), 'argument' => json_encode($job->getArgument()), - ], - $jobs - ); + ]; + } + return $jobsInfo; } } |