summaryrefslogtreecommitdiff
path: root/app/Api
diff options
context:
space:
mode:
Diffstat (limited to 'app/Api')
-rw-r--r--app/Api/Base.php10
-rw-r--r--app/Api/File.php15
2 files changed, 15 insertions, 10 deletions
diff --git a/app/Api/Base.php b/app/Api/Base.php
index fef36e0c..0287e0ec 100644
--- a/app/Api/Base.php
+++ b/app/Api/Base.php
@@ -54,6 +54,8 @@ abstract class Base extends \Core\Base
else if (! $is_user && ! $is_both_procedure && $is_user_procedure) {
throw new AccessDeniedException('Permission denied');
}
+
+ $this->logger->debug('API call: '.$procedure);
}
public function checkProjectPermission($project_id)
@@ -70,7 +72,7 @@ abstract class Base extends \Core\Base
}
}
- protected function formatTask(array $task)
+ protected function formatTask($task)
{
if (! empty($task)) {
$task['url'] = $this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), '', true);
@@ -80,7 +82,7 @@ abstract class Base extends \Core\Base
return $task;
}
- protected function formatTasks(array $tasks)
+ protected function formatTasks($tasks)
{
if (! empty($tasks)) {
foreach ($tasks as &$task) {
@@ -91,7 +93,7 @@ abstract class Base extends \Core\Base
return $tasks;
}
- protected function formatProject(array $project)
+ protected function formatProject($project)
{
if (! empty($project)) {
$project['url'] = array(
@@ -104,7 +106,7 @@ abstract class Base extends \Core\Base
return $project;
}
- protected function formatProjects(array $projects)
+ protected function formatProjects($projects)
{
if (! empty($projects)) {
foreach ($projects as &$project) {
diff --git a/app/Api/File.php b/app/Api/File.php
index 97aa9d82..ad736ad4 100644
--- a/app/Api/File.php
+++ b/app/Api/File.php
@@ -2,6 +2,8 @@
namespace Api;
+use Core\ObjectStorage\ObjectStorageException;
+
/**
* File API controller
*
@@ -22,16 +24,17 @@ class File extends \Core\Base
public function downloadFile($file_id)
{
- $file = $this->file->getById($file_id);
-
- if (! empty($file)) {
+ try {
- $filename = FILES_DIR.$file['path'];
+ $file = $this->file->getById($file_id);
- if (file_exists($filename)) {
- return base64_encode(file_get_contents($filename));
+ if (! empty($file)) {
+ return base64_encode($this->objectStorage->get($file['path']));
}
}
+ catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+ }
return '';
}