diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-07-01 13:01:46 (GMT) |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-07-01 13:01:46 (GMT) |
commit | 315c38c54dd3832b44b8a8bfd1497d1d3326801c (patch) | |
tree | a0387490365e9ae105e2115edd7a163e8c917379 /lib | |
parent | 8b51aa770a9d5637d6f77d42b61841852793061c (diff) | |
download | iRony-315c38c54dd3832b44b8a8bfd1497d1d3326801c.tar.gz |
Use php://temp resource to fetch file bodies
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kolab/DAV/File.php | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/Kolab/DAV/File.php b/lib/Kolab/DAV/File.php index ff6c698..0fb9bb3 100644 --- a/lib/Kolab/DAV/File.php +++ b/lib/Kolab/DAV/File.php @@ -73,7 +73,7 @@ class File extends Node implements \Sabre\DAV\IFile } /** - * Returns the data + * Returns the file content * * This method may either return a string or a readable stream resource * @@ -81,16 +81,10 @@ class File extends Node implements \Sabre\DAV\IFile */ public function get() { - // @TODO: make file path to be based on user ID and file ETag - // and check if it exists before - use it for better performance - $rcube = rcube::get_instance(); - $temp_dir = unslashify($rcube->config->get('temp_dir')); - $file_path = tempnam($temp_dir, 'davFile'); - - $fp = @fopen($file_path, 'bw+'); - try { + $fp = fopen('php://temp', 'bw+'); $this->backend->file_get($this->path, array(), $fp); + rewind($fp); } catch (Exception $e) { // throw new \Sabre\DAV\Exception\Forbidden($e->getMessage()); |