Skip to content
Snippets Groups Projects
Unverified Commit c92e64b5 authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

Merge pull request #17545 from nextcloud/bugfix/noid/workflow-catch

Ignore unavailable entity/operation classes
parents 83674f1b 99c30453
Branches
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
namespace OCA\WorkflowEngine\AppInfo; namespace OCA\WorkflowEngine\AppInfo;
use OCA\WorkflowEngine\Manager; use OCA\WorkflowEngine\Manager;
use OCP\AppFramework\QueryException;
use OCP\Template; use OCP\Template;
use OCA\WorkflowEngine\Controller\RequestTime; use OCA\WorkflowEngine\Controller\RequestTime;
use OCP\WorkflowEngine\IEntity; use OCP\WorkflowEngine\IEntity;
...@@ -89,12 +90,16 @@ class Application extends \OCP\AppFramework\App { ...@@ -89,12 +90,16 @@ class Application extends \OCP\AppFramework\App {
$eventName, $eventName,
function (GenericEvent $event) use ($eventName, $operationClass, $entityClass) { function (GenericEvent $event) use ($eventName, $operationClass, $entityClass) {
$ruleMatcher = $this->manager->getRuleMatcher(); $ruleMatcher = $this->manager->getRuleMatcher();
/** @var IEntity $entity */ try {
$entity = $this->getContainer()->query($entityClass); /** @var IEntity $entity */
$entity->prepareRuleMatcher($ruleMatcher, $eventName, $event); $entity = $this->getContainer()->query($entityClass);
/** @var IOperation $operation */ $entity->prepareRuleMatcher($ruleMatcher, $eventName, $event);
$operation = $this->getContainer()->query($operationClass); /** @var IOperation $operation */
$operation->onEvent($eventName, $event, $ruleMatcher); $operation = $this->getContainer()->query($operationClass);
$operation->onEvent($eventName, $event, $ruleMatcher);
} catch (QueryException $e) {
// Ignore query exceptions since they might occur when an entity/operation were setup before by an app that is disabled now
}
} }
); );
}, $eventNames); }, $eventNames);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment