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.
This commit is contained in:
@@ -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'));
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error(__METHOD__.': '.$e->getMessage());
|
||||
}
|
||||
|
||||
$this->dispatcher->addListener($action['event_name'], array($listener, 'execute'));
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user