aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/BackgroundJob
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-07-14 14:50:12 +0200
committerJulien Veyssier <julien-nc@posteo.net>2024-05-02 16:43:41 +0200
commit8400bfee019f310494a345aa35643a44137a33cf (patch)
tree237011bf60eac575d81b1eb07676eeb1eb874c61 /lib/private/BackgroundJob
parent52eb6d87263302a520e0d78a3ec3f9e86ecf477f (diff)
downloadnextcloud-server-8400bfee019f310494a345aa35643a44137a33cf.tar.gz
nextcloud-server-8400bfee019f310494a345aa35643a44137a33cf.zip
feat(bg-jobs): Add background worker occ command
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/BackgroundJob')
-rw-r--r--lib/private/BackgroundJob/JobList.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php
index 3e8b5cf2988..c7291d3ce04 100644
--- a/lib/private/BackgroundJob/JobList.php
+++ b/lib/private/BackgroundJob/JobList.php
@@ -436,4 +436,23 @@ class JobList implements IJobList {
return false;
}
}
+
+ public function countByClass(): array {
+ $query = $this->connection->getQueryBuilder();
+ $query->select('class')
+ ->selectAlias($query->func()->count('id'), 'count')
+ ->from('jobs')
+ ->orderBy('count')
+ ->groupBy('class');
+
+ $result = $query->executeQuery();
+
+ $jobs = [];
+ while ($row = $result->fetch()) {
+ $jobs[] = $row;
+ }
+
+ return $jobs;
+
+ }
}