From 8ad2f340453cade0bf0b37d02e5cdadf49381abb Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Wed, 26 Apr 2023 15:11:47 +0200 Subject: [PATCH] Remove job from oc_jobs when the file is not findable When an application is disabled, or when a background jobs is removed by the app developer, then the job won't be found. In those cases, it makes sense to remove those jobs from oc_job. Signed-off-by: Louis Chemineau --- lib/private/BackgroundJob/JobList.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index fbeee1f56e9..3cdfee51138 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -307,7 +307,8 @@ class JobList implements IJobList { $class = $row['class']; $job = new $class(); } else { - // job from disabled app or old version of an app, no need to do anything + // Remove job from disabled app or old version of an app + $this->removeById($row['id']); return null; } }