summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-08-04 15:41:35 +0200
committerJulien Veyssier <julien-nc@posteo.net>2023-08-09 14:58:02 +0200
commit0564bd23f2c270c389455082ef53be8d7f8a6219 (patch)
tree2f7ae749aa6e495db198ec2db45858ab940971ed /lib/private
parentf363f1153e5dc6032c2c679cc466a4078e93bfed (diff)
downloadnextcloud-server-0564bd23f2c270c389455082ef53be8d7f8a6219.tar.gz
nextcloud-server-0564bd23f2c270c389455082ef53be8d7f8a6219.zip
feat: Add delete task API
Signed-off-by: Julius Härtl <jus@bitgrid.net> (cherry picked from commit fca1c309a025e34cc5d635766796d9e5b4f9386b) Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/TextProcessing/Manager.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/TextProcessing/Manager.php b/lib/private/TextProcessing/Manager.php
index c8302f1e8df..b9cb06c298e 100644
--- a/lib/private/TextProcessing/Manager.php
+++ b/lib/private/TextProcessing/Manager.php
@@ -28,6 +28,7 @@ namespace OC\TextProcessing;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\TextProcessing\Db\Task as DbTask;
use OCP\IConfig;
+use OCP\TextProcessing\Task;
use OCP\TextProcessing\Task as OCPTask;
use OC\TextProcessing\Db\TaskMapper;
use OCP\AppFramework\Db\DoesNotExistException;
@@ -178,6 +179,17 @@ class Manager implements IManager {
}
/**
+ * @inheritDoc
+ */
+ public function deleteTask(Task $task): void {
+ $taskEntity = DbTask::fromPublicTask($task);
+ $this->taskMapper->delete($taskEntity);
+ $this->jobList->remove(TaskBackgroundJob::class, [
+ 'taskId' => $task->getId()
+ ]);
+ }
+
+ /**
* Get a task from its id
*
* @param int $id The id of the task