fix(apps): Remove jobs when an app gets disabled

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
This commit is contained in:
Josh Richards 2025-02-06 11:14:54 -05:00
parent f9c03f7606
commit c5257fed1a
2 changed files with 8 additions and 0 deletions

View file

@ -672,6 +672,7 @@ class AppManager implements IAppManager {
$appData = $this->getAppInfo($appId);
if (!is_null($appData)) {
\OC_App::executeRepairSteps($appId, $appData['repair-steps']['uninstall']);
\OC_App::removeBackgroundJobs($appData['background-jobs']);
}
$this->dispatcher->dispatchTyped(new AppDisableEvent($appId));

View file

@ -755,6 +755,13 @@ class OC_App {
$r->run();
}
public static function removeBackgroundJobs(array $jobs) {
$queue = \OC::$server->getJobList();
foreach ($jobs as $job) {
$queue->remove($job);
}
}
public static function setupBackgroundJobs(array $jobs) {
$queue = \OC::$server->getJobList();
foreach ($jobs as $job) {