aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/Background
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-06-27 16:01:55 +0200
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2022-07-11 09:46:23 +0000
commitcc89da26c6b18db8680b75b58b965052c9c9a60f (patch)
tree910399bea095a35d5fd43986753116e9f0b92ffe /core/Command/Background
parent3920fc1ef267c4189f29481c58c9d7866e53f7a4 (diff)
downloadnextcloud-server-cc89da26c6b18db8680b75b58b965052c9c9a60f.tar.gz
nextcloud-server-cc89da26c6b18db8680b75b58b965052c9c9a60f.zip
Fix background-job:execute command for QueuedJob instances
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'core/Command/Background')
-rw-r--r--core/Command/Background/Job.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php
index 742bdd4329e..823498cf8ca 100644
--- a/core/Command/Background/Job.php
+++ b/core/Command/Background/Job.php
@@ -85,10 +85,14 @@ class Job extends Command {
}
$job = $this->jobList->getById($jobId);
+ if ($job === null) {
+ $output->writeln('<error>Something went wrong when trying to retrieve Job with ID ' . $jobId . ' from database</error>');
+ return 1;
+ }
$job->execute($this->jobList, $this->logger);
$job = $this->jobList->getById($jobId);
- if ($lastRun !== $job->getLastRun()) {
+ if (($job === null) || ($lastRun !== $job->getLastRun())) {
$output->writeln('<info>Job executed!</info>');
$output->writeln('');