Do not check anymore data folder permissions

People who are using a remote database (Mysql/Postgresql) and a remote file storage (Aws S3 or similar) don't necessary needs to have a persistent local data folder or to change the permissions.
This commit is contained in:
Frederic Guillot
2015-09-23 20:59:21 -04:00
parent 2af45250c4
commit 25b9e90ef3
8 changed files with 74 additions and 50 deletions

View File

@@ -2,6 +2,8 @@
namespace Controller;
use Core\ObjectStorage\ObjectStorageException;
/**
* File controller
*
@@ -74,15 +76,21 @@ class File extends Base
*/
public function download()
{
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
try {
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
}
$this->response->forceDownload($file['name']);
$this->objectStorage->passthru($file['path']);
}
catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
$this->response->forceDownload($file['name']);
$this->objectStorage->passthru($file['path']);
}
/**
@@ -110,15 +118,21 @@ class File extends Base
*/
public function image()
{
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
try {
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
}
$this->response->contentType($this->file->getImageMimeType($file['name']));
$this->objectStorage->passthru($file['path']);
}
catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
$this->response->contentType($this->file->getImageMimeType($file['name']));
$this->objectStorage->passthru($file['path']);
}
/**
@@ -128,15 +142,21 @@ class File extends Base
*/
public function thumbnail()
{
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
try {
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
}
$this->response->contentType('image/jpeg');
$this->objectStorage->passthru($this->file->getThumbnailPath($file['path']));
}
catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
$this->response->contentType('image/jpeg');
$this->objectStorage->passthru($this->file->getThumbnailPath($file['path']));
}
/**