summaryrefslogtreecommitdiff
path: root/app/Api/File.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-02-14 15:25:16 -0500
committerFrederic Guillot <fred@kanboard.net>2016-02-14 15:25:16 -0500
commit8e25c875f26b05e3138fb4d09d9f720456c09f76 (patch)
tree103921f8ba3734a7c524efd0ed0ab68d4f919a13 /app/Api/File.php
parentfbb58e08d3dbe0ec39f5d71d6aaa64528293bc71 (diff)
Add ProjecFile and TaskFile models
Diffstat (limited to 'app/Api/File.php')
-rw-r--r--app/Api/File.php55
1 files changed, 44 insertions, 11 deletions
diff --git a/app/Api/File.php b/app/Api/File.php
index 269803e1..e4204e6d 100644
--- a/app/Api/File.php
+++ b/app/Api/File.php
@@ -2,6 +2,7 @@
namespace Kanboard\Api;
+use Kanboard\Core\Base;
use Kanboard\Core\ObjectStorage\ObjectStorageException;
/**
@@ -10,22 +11,22 @@ use Kanboard\Core\ObjectStorage\ObjectStorageException;
* @package api
* @author Frederic Guillot
*/
-class File extends \Kanboard\Core\Base
+class File extends Base
{
- public function getFile($file_id)
+ public function getTaskFile($file_id)
{
- return $this->file->getById($file_id);
+ return $this->taskFile->getById($file_id);
}
- public function getAllFiles($task_id)
+ public function getAllTaskFiles($task_id)
{
- return $this->file->getAll($task_id);
+ return $this->taskFile->getAll($task_id);
}
- public function downloadFile($file_id)
+ public function downloadTaskFile($file_id)
{
try {
- $file = $this->file->getById($file_id);
+ $file = $this->taskFile->getById($file_id);
if (! empty($file)) {
return base64_encode($this->objectStorage->get($file['path']));
@@ -36,23 +37,55 @@ class File extends \Kanboard\Core\Base
}
}
- public function createFile($project_id, $task_id, $filename, $blob)
+ public function createTaskFile($project_id, $task_id, $filename, $blob)
{
try {
- return $this->file->uploadContent($project_id, $task_id, $filename, $blob);
+ return $this->taskFile->uploadContent($task_id, $filename, $blob);
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
return false;
}
}
+ public function removeTaskFile($file_id)
+ {
+ return $this->taskFile->remove($file_id);
+ }
+
+ public function removeAllTaskFiles($task_id)
+ {
+ return $this->taskFile->removeAll($task_id);
+ }
+
+ // Deprecated procedures
+
+ public function getFile($file_id)
+ {
+ return $this->getTaskFile($file_id);
+ }
+
+ public function getAllFiles($task_id)
+ {
+ return $this->getAllTaskFiles($task_id);
+ }
+
+ public function downloadFile($file_id)
+ {
+ return $this->downloadTaskFile($file_id);
+ }
+
+ public function createFile($project_id, $task_id, $filename, $blob)
+ {
+ return $this->createTaskFile($project_id, $task_id, $filename, $blob);
+ }
+
public function removeFile($file_id)
{
- return $this->file->remove($file_id);
+ return $this->removeTaskFile($file_id);
}
public function removeAllFiles($task_id)
{
- return $this->file->removeAll($task_id);
+ return $this->removeAllTaskFiles($task_id);
}
}