Change interface for objectStorage
This commit is contained in:
@@ -86,7 +86,7 @@ class File extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->response->forceDownload($file['name']);
|
$this->response->forceDownload($file['name']);
|
||||||
$this->objectStorage->passthru($file['path']);
|
$this->objectStorage->output($file['path']);
|
||||||
}
|
}
|
||||||
catch (ObjectStorageException $e) {
|
catch (ObjectStorageException $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
@@ -128,7 +128,7 @@ class File extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->response->contentType($this->file->getImageMimeType($file['name']));
|
$this->response->contentType($this->file->getImageMimeType($file['name']));
|
||||||
$this->objectStorage->passthru($file['path']);
|
$this->objectStorage->output($file['path']);
|
||||||
}
|
}
|
||||||
catch (ObjectStorageException $e) {
|
catch (ObjectStorageException $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
@@ -152,7 +152,7 @@ class File extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->response->contentType('image/jpeg');
|
$this->response->contentType('image/jpeg');
|
||||||
$this->objectStorage->passthru($this->file->getThumbnailPath($file['path']));
|
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
|
||||||
}
|
}
|
||||||
catch (ObjectStorageException $e) {
|
catch (ObjectStorageException $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class FileStorage implements ObjectStorageInterface
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*/
|
*/
|
||||||
public function passthru($key)
|
public function output($key)
|
||||||
{
|
{
|
||||||
$filename = $this->path.DIRECTORY_SEPARATOR.$key;
|
$filename = $this->path.DIRECTORY_SEPARATOR.$key;
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ interface ObjectStorageInterface
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*/
|
*/
|
||||||
public function passthru($key);
|
public function output($key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move local file to object storage
|
* Move local file to object storage
|
||||||
|
|||||||
@@ -227,13 +227,21 @@ class FileTest extends Base
|
|||||||
->expects($this->at(1))
|
->expects($this->at(1))
|
||||||
->method('remove')
|
->method('remove')
|
||||||
->with(
|
->with(
|
||||||
$this->equalTo('/tmp/foo1')
|
$this->equalTo('thumbnails//tmp/foo2')
|
||||||
)
|
)
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
$this->container['objectStorage']
|
$this->container['objectStorage']
|
||||||
->expects($this->at(2))
|
->expects($this->at(2))
|
||||||
->method('remove')
|
->method('remove')
|
||||||
|
->with(
|
||||||
|
$this->equalTo('/tmp/foo1')
|
||||||
|
)
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
|
$this->container['objectStorage']
|
||||||
|
->expects($this->at(3))
|
||||||
|
->method('remove')
|
||||||
->with(
|
->with(
|
||||||
$this->equalTo('/tmp/foo3')
|
$this->equalTo('/tmp/foo3')
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user