From ddbb9b7ec4df7654d471808ca7d7ee4ecb069471 Mon Sep 17 00:00:00 2001
From: Morris Jobke <hey@morrisjobke.de>
Date: Mon, 11 Apr 2016 14:06:11 +0200
Subject: [PATCH] Catch the AutoloadNotAllowedException also for legacy jobs
 (#23901)

* same as #18839 for legacy jobs
* avoids spamming the log with useless entries
---
 lib/private/backgroundjob/legacy/regularjob.php | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/private/backgroundjob/legacy/regularjob.php b/lib/private/backgroundjob/legacy/regularjob.php
index 8e8b6634c11..aedd6ef657a 100644
--- a/lib/private/backgroundjob/legacy/regularjob.php
+++ b/lib/private/backgroundjob/legacy/regularjob.php
@@ -22,10 +22,17 @@
 
 namespace OC\BackgroundJob\Legacy;
 
+use OCP\AutoloadNotAllowedException;
+
 class RegularJob extends \OC\BackgroundJob\Job {
 	public function run($argument) {
-		if (is_callable($argument)) {
-			call_user_func($argument);
+		try {
+			if (is_callable($argument)) {
+				call_user_func($argument);
+			}
+		} catch (AutoloadNotAllowedException $e) {
+			// job is from a disabled app, ignore
+			return null;
 		}
 	}
 }
-- 
GitLab