diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Api/Procedure/TaskProcedure.php | 25 | ||||
-rw-r--r-- | app/Core/Action/ActionManager.php | 16 | ||||
-rw-r--r-- | app/Core/Queue/JobHandler.php | 14 |
3 files changed, 54 insertions, 1 deletions
diff --git a/app/Api/Procedure/TaskProcedure.php b/app/Api/Procedure/TaskProcedure.php index 8661deef..59075b13 100644 --- a/app/Api/Procedure/TaskProcedure.php +++ b/app/Api/Procedure/TaskProcedure.php @@ -6,6 +6,7 @@ use Kanboard\Api\Authorization\ProjectAuthorization; use Kanboard\Api\Authorization\TaskAuthorization; use Kanboard\Filter\TaskProjectFilter; use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskMetadataModel; /** * Task API controller @@ -15,6 +16,30 @@ use Kanboard\Model\TaskModel; */ class TaskProcedure extends BaseProcedure { + public function getTaskMetadata($task_id) + { + TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'getTask', $task_id); + return $this->taskMetadataModel->getAll($task_id); + } + + public function getTaskMetadataByName($task_id, $name) + { + TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'getTask', $task_id); + return $this->taskMetadataModel->get($task_id, $name); + } + + public function saveTaskMetadata($task_id, array $values) + { + TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateTask', $task_id); + return $this->taskMetadataModel->save($task_id, $values); + } + + public function removeTaskMetadata($task_id, $name) + { + TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateTask', $task_id); + return $this->taskMetadataModel->remove($task_id, $name); + } + public function searchTasks($project_id, $query) { ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'searchTasks', $project_id); diff --git a/app/Core/Action/ActionManager.php b/app/Core/Action/ActionManager.php index 1dfd820c..aec9ef02 100644 --- a/app/Core/Action/ActionManager.php +++ b/app/Core/Action/ActionManager.php @@ -139,4 +139,20 @@ class ActionManager extends Base return $this; } + + /** + * Remove all listeners for automated actions + * + * @access public + */ + public function removeEvents() + { + foreach ($this->dispatcher->getListeners() as $eventName => $listeners) { + foreach ($listeners as $listener) { + if (is_array($listener) && $listener[0] instanceof ActionBase) { + $this->dispatcher->removeListener($eventName, $listener); + } + } + } + } } diff --git a/app/Core/Queue/JobHandler.php b/app/Core/Queue/JobHandler.php index 326f3cef..11c1fb69 100644 --- a/app/Core/Queue/JobHandler.php +++ b/app/Core/Queue/JobHandler.php @@ -43,8 +43,8 @@ class JobHandler extends Base try { $className = $payload['class']; - $this->memoryCache->flush(); $this->prepareJobSession($payload['user_id']); + $this->prepareJobEnvironment(); if (DEBUG) { $this->logger->debug(__METHOD__.' Received job => '.$className.' ('.getmypid().')'); @@ -75,4 +75,16 @@ class JobHandler extends Base $this->userSession->initialize($user); } } + + /** + * Flush in-memory caching and specific events + * + * @access protected + */ + protected function prepareJobEnvironment() + { + $this->memoryCache->flush(); + $this->actionManager->removeEvents(); + $this->dispatcher->dispatch('app.bootstrap'); + } } |