From b35122f7a6ad42756c35bb60ba1f06c3dcd45c77 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 21 Oct 2013 15:46:31 -0700 Subject: add sabre (1.8.x) via composer in the !@#$ place it wants to be --- vendor/sabre/dav/lib/Sabre/DAV/FSExt/File.php | 118 ++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 vendor/sabre/dav/lib/Sabre/DAV/FSExt/File.php (limited to 'vendor/sabre/dav/lib/Sabre/DAV/FSExt/File.php') diff --git a/vendor/sabre/dav/lib/Sabre/DAV/FSExt/File.php b/vendor/sabre/dav/lib/Sabre/DAV/FSExt/File.php new file mode 100644 index 000000000..402195757 --- /dev/null +++ b/vendor/sabre/dav/lib/Sabre/DAV/FSExt/File.php @@ -0,0 +1,118 @@ +path,$data); + return '"' . md5_file($this->path) . '"'; + + } + + /** + * Updates the data at a given offset + * + * The data argument is a readable stream resource. + * The offset argument is a 0-based offset where the data should be + * written. + * + * param resource|string $data + * @return void + */ + public function putRange($data, $offset) { + + $f = fopen($this->path, 'c'); + fseek($f,$offset-1); + if (is_string($data)) { + fwrite($f, $data); + } else { + stream_copy_to_stream($data,$f); + } + fclose($f); + return '"' . md5_file($this->path) . '"'; + + } + + /** + * Returns the data + * + * @return resource + */ + public function get() { + + return fopen($this->path,'r'); + + } + + /** + * Delete the current file + * + * @return bool + */ + public function delete() { + + unlink($this->path); + return parent::delete(); + + } + + /** + * Returns the ETag for a file + * + * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. + * The ETag is an arbitrary string, but MUST be surrounded by double-quotes. + * + * Return null if the ETag can not effectively be determined + * + * @return string|null + */ + public function getETag() { + + return '"' . md5_file($this->path). '"'; + + } + + /** + * Returns the mime-type for a file + * + * If null is returned, we'll assume application/octet-stream + * + * @return string|null + */ + public function getContentType() { + + return null; + + } + + /** + * Returns the size of the file, in bytes + * + * @return int + */ + public function getSize() { + + return filesize($this->path); + + } + +} + -- cgit v1.2.3