summaryrefslogtreecommitdiffstats
path: root/lib/private/BackgroundJob
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-06-27 11:53:10 +0200
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2022-07-11 09:46:23 +0000
commit868d748dbfa51461b5ee7cc827be6f314ae0959d (patch)
treeeb5f33d57e2185c47c8d344e6b45d57dd189b93d /lib/private/BackgroundJob
parent3d0117990749bebe5394ff664d62494ae9a6fa1e (diff)
downloadnextcloud-server-868d748dbfa51461b5ee7cc827be6f314ae0959d.tar.gz
nextcloud-server-868d748dbfa51461b5ee7cc827be6f314ae0959d.zip
Code cleaning of Background/ListCommand
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/BackgroundJob')
-rw-r--r--lib/private/BackgroundJob/JobList.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php
index 8ba993646a9..82e8e86c5c6 100644
--- a/lib/private/BackgroundJob/JobList.php
+++ b/lib/private/BackgroundJob/JobList.php
@@ -40,7 +40,6 @@ use OCP\IConfig;
use OCP\IDBConnection;
class JobList implements IJobList {
-
protected IDBConnection $connection;
protected IConfig $config;
protected ITimeFactory $timeFactory;
@@ -163,12 +162,16 @@ class JobList implements IJobList {
*
* @return IJob[]
* @deprecated 9.0.0 - This method is dangerous since it can cause load and
- * memory problems when creating too many instances.
+ * memory problems when creating too many instances. Use getJobs instead.
*/
public function getAll() {
return $this->getJobs(null, null, 0);
}
+ /**
+ * @param IJob|class-string<IJob>|null $job
+ * @return IJob[]
+ */
public function getJobs($job, ?int $limit, int $offset): array {
$query = $this->connection->getQueryBuilder();
$query->select('*')
@@ -297,7 +300,7 @@ class JobList implements IJobList {
try {
// Try to load the job as a service
/** @var IJob $job */
- $job = \OC::$server->get($row['class']);
+ $job = \OCP\Server::get($row['class']);
} catch (QueryException $e) {
if (class_exists($row['class'])) {
$class = $row['class'];