aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2023-01-16 11:10:10 +0100
committerGitHub <noreply@github.com>2023-01-16 11:10:10 +0100
commitdbfe7b1816ee4d7756478d3abbe336a2cf3dbe57 (patch)
tree0b3ed4442f2cad09c47ba73dd752ddf09cb443dd /core
parent5e090d044d3d660316450c3d4d2d7bfc3bde20dd (diff)
parentd74044f6341e93861d820f21b6d37a2f98e1ef60 (diff)
downloadnextcloud-server-dbfe7b1816ee4d7756478d3abbe336a2cf3dbe57.tar.gz
nextcloud-server-dbfe7b1816ee4d7756478d3abbe336a2cf3dbe57.zip
Merge pull request #36073 from nextcloud/fix/fix-background-job-list
Use a Generator for job list to fix background-job:list command
Diffstat (limited to 'core')
-rw-r--r--core/Command/Background/ListCommand.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php
index bdd45f3a25f..4116bfa0ff1 100644
--- a/core/Command/Background/ListCommand.php
+++ b/core/Command/Background/ListCommand.php
@@ -67,20 +67,21 @@ class ListCommand extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
- $jobs = $this->jobList->getJobs($input->getOption('class'), (int)$input->getOption('limit'), (int)$input->getOption('offset'));
+ $jobs = $this->jobList->getJobsIterator($input->getOption('class'), (int)$input->getOption('limit'), (int)$input->getOption('offset'));
$this->writeTableInOutputFormat($input, $output, $this->formatJobs($jobs));
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;
}
}