Skip to content

Commit

Permalink
fix(apps): Remove jobs when an app gets disabled
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Richards <[email protected]>
  • Loading branch information
joshtrichards committed Feb 6, 2025
1 parent f9c03f7 commit c5257fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ public function disableApp($appId, $automaticDisabled = false): void {
$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));
Expand Down
7 changes: 7 additions & 0 deletions lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,13 @@ public static function executeRepairSteps(string $appId, array $steps) {
$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) {
Expand Down

0 comments on commit c5257fe

Please sign in to comment.