summaryrefslogtreecommitdiffstats
path: root/lib/private/BackgroundJob/JobList.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/BackgroundJob/JobList.php')
-rw-r--r--lib/private/BackgroundJob/JobList.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php
index 494735ad873..67b736b8dd9 100644
--- a/lib/private/BackgroundJob/JobList.php
+++ b/lib/private/BackgroundJob/JobList.php
@@ -157,11 +157,20 @@ class JobList implements IJobList {
return (bool) $row;
}
+ public function getJobs($job, ?int $limit, int $offset): array {
+ $iterable = $this->getJobsIterator($job, $limit, $offset);
+ if (is_array($iterable)) {
+ return $iterable;
+ } else {
+ return iterator_to_array($iterable);
+ }
+ }
+
/**
* @param IJob|class-string<IJob>|null $job
* @return iterable<IJob> Avoid to store these objects as they may share a Singleton instance. You should instead use these IJobs instances while looping on the iterable.
*/
- public function getJobs($job, ?int $limit, int $offset): iterable {
+ public function getJobsIterator($job, ?int $limit, int $offset): iterable {
$query = $this->connection->getQueryBuilder();
$query->select('*')
->from('jobs')