diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-02-19 12:00:35 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-02-19 12:00:35 -0500 |
commit | 778c9d82126560980d6473a708cd45c8ee0ba330 (patch) | |
tree | 21b0e16b87a30d8275d62b14d07a39b604a1b512 /app/Core | |
parent | 23ff360d6232bbaf397405f0ac048f4200cea4ad (diff) |
Allow people to remove missing automatic actions
When an automatic action is installed from a plugin,
if the plugin is removed the automatic could stay
in the database if the user didn't remove manually
the automatic action.
Diffstat (limited to 'app/Core')
-rw-r--r-- | app/Core/Action/ActionManager.php | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/app/Core/Action/ActionManager.php b/app/Core/Action/ActionManager.php index aec9ef02..3a77084d 100644 --- a/app/Core/Action/ActionManager.php +++ b/app/Core/Action/ActionManager.php @@ -2,6 +2,7 @@ namespace Kanboard\Core\Action; +use Exception; use RuntimeException; use Kanboard\Core\Base; use Kanboard\Action\Base as ActionBase; @@ -84,8 +85,12 @@ class ActionManager extends Base $params = array(); foreach ($actions as $action) { - $currentAction = $this->getAction($action['action_name']); - $params[$currentAction->getName()] = $currentAction->getActionRequiredParameters(); + try { + $currentAction = $this->getAction($action['action_name']); + $params[$currentAction->getName()] = $currentAction->getActionRequiredParameters(); + } catch (Exception $e) { + $this->logger->error(__METHOD__.': '.$e->getMessage()); + } } return $params; @@ -127,14 +132,18 @@ class ActionManager extends Base } foreach ($actions as $action) { - $listener = clone $this->getAction($action['action_name']); - $listener->setProjectId($action['project_id']); + try { + $listener = clone $this->getAction($action['action_name']); + $listener->setProjectId($action['project_id']); - foreach ($action['params'] as $param_name => $param_value) { - $listener->setParam($param_name, $param_value); - } + foreach ($action['params'] as $param_name => $param_value) { + $listener->setParam($param_name, $param_value); + } - $this->dispatcher->addListener($action['event_name'], array($listener, 'execute')); + $this->dispatcher->addListener($action['event_name'], array($listener, 'execute')); + } catch (Exception $e) { + $this->logger->error(__METHOD__.': '.$e->getMessage()); + } } return $this; |