From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- vendor/sabre/dav/lib/DAV/FS/Directory.php | 92 +++++++++++++++---------------- vendor/sabre/dav/lib/DAV/FS/File.php | 62 +++++++++------------ vendor/sabre/dav/lib/DAV/FS/Node.php | 72 ++++++++++++++---------- 3 files changed, 115 insertions(+), 111 deletions(-) (limited to 'vendor/sabre/dav/lib/DAV/FS') diff --git a/vendor/sabre/dav/lib/DAV/FS/Directory.php b/vendor/sabre/dav/lib/DAV/FS/Directory.php index 362f7a411..047692294 100644 --- a/vendor/sabre/dav/lib/DAV/FS/Directory.php +++ b/vendor/sabre/dav/lib/DAV/FS/Directory.php @@ -1,20 +1,22 @@ path . '/' . $name; + public function createFile($name, $data = null) + { + $newPath = $this->path.'/'.$name; file_put_contents($newPath, $data); clearstatcache(true, $newPath); - } /** - * Creates a new subdirectory + * Creates a new subdirectory. * * @param string $name - * @return void */ - function createDirectory($name) { - - $newPath = $this->path . '/' . $name; + public function createDirectory($name) + { + $newPath = $this->path.'/'.$name; mkdir($newPath); clearstatcache(true, $newPath); - } /** - * Returns a specific child node, referenced by its name + * Returns a specific child node, referenced by its name. * * This method must throw DAV\Exception\NotFound if the node does not * exist. * * @param string $name + * * @throws DAV\Exception\NotFound + * * @return DAV\INode */ - function getChild($name) { - - $path = $this->path . '/' . $name; - - if (!file_exists($path)) throw new DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); + public function getChild($name) + { + $path = $this->path.'/'.$name; + if (!file_exists($path)) { + throw new DAV\Exception\NotFound('File with name '.$path.' could not be located'); + } if (is_dir($path)) { - return new self($path); - } else { - return new File($path); - } - } /** - * Returns an array with all the child nodes + * Returns an array with all the child nodes. * * @return DAV\INode[] */ - function getChildren() { - + public function getChildren() + { $nodes = []; $iterator = new \FilesystemIterator( $this->path, @@ -101,51 +99,49 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota { | \FilesystemIterator::SKIP_DOTS ); foreach ($iterator as $entry) { - $nodes[] = $this->getChild($entry->getFilename()); - } - return $nodes; + return $nodes; } /** * Checks if a child exists. * * @param string $name + * * @return bool */ - function childExists($name) { + public function childExists($name) + { + $path = $this->path.'/'.$name; - $path = $this->path . '/' . $name; return file_exists($path); - } /** - * Deletes all files in this directory, and then itself - * - * @return void + * Deletes all files in this directory, and then itself. */ - function delete() { - - foreach ($this->getChildren() as $child) $child->delete(); + public function delete() + { + foreach ($this->getChildren() as $child) { + $child->delete(); + } rmdir($this->path); - } /** - * Returns available diskspace information + * Returns available diskspace information. * * @return array */ - function getQuotaInfo() { + public function getQuotaInfo() + { $absolute = realpath($this->path); + return [ disk_total_space($absolute) - disk_free_space($absolute), - disk_free_space($absolute) + disk_free_space($absolute), ]; - } - } diff --git a/vendor/sabre/dav/lib/DAV/FS/File.php b/vendor/sabre/dav/lib/DAV/FS/File.php index 4fc5af057..b78a80138 100644 --- a/vendor/sabre/dav/lib/DAV/FS/File.php +++ b/vendor/sabre/dav/lib/DAV/FS/File.php @@ -1,66 +1,61 @@ path, $data); clearstatcache(true, $this->path); - } /** - * Returns the data + * Returns the data. * * @return resource */ - function get() { - + public function get() + { return fopen($this->path, 'r'); - } /** - * Delete the current file - * - * @return void + * Delete the current file. */ - function delete() { - + public function delete() + { unlink($this->path); - } /** - * Returns the size of the node, in bytes + * Returns the size of the node, in bytes. * * @return int */ - function getSize() { - + public function getSize() + { return filesize($this->path); - } /** - * Returns the ETag for a file + * 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. @@ -69,27 +64,24 @@ class File extends Node implements DAV\IFile { * * @return mixed */ - function getETag() { - - return '"' . sha1( - fileinode($this->path) . - filesize($this->path) . + public function getETag() + { + return '"'.sha1( + fileinode($this->path). + filesize($this->path). filemtime($this->path) - ) . '"'; - + ).'"'; } /** - * Returns the mime-type for a file + * Returns the mime-type for a file. * * If null is returned, we'll assume application/octet-stream * * @return mixed */ - function getContentType() { - + public function getContentType() + { return null; - } - } diff --git a/vendor/sabre/dav/lib/DAV/FS/Node.php b/vendor/sabre/dav/lib/DAV/FS/Node.php index 424718f96..32aa74755 100644 --- a/vendor/sabre/dav/lib/DAV/FS/Node.php +++ b/vendor/sabre/dav/lib/DAV/FS/Node.php @@ -1,12 +1,15 @@ path = $path; - + $this->overrideName = $overrideName; } - - /** - * Returns the name of the node + * Returns the name of the node. * * @return string */ - function getName() { + public function getName() + { + if ($this->overrideName) { + return $this->overrideName; + } - list(, $name) = URLUtil::splitPath($this->path); - return $name; + list(, $name) = Uri\split($this->path); + return $name; } /** - * Renames the node + * Renames the node. * * @param string $name The new name - * @return void */ - function setName($name) { + public function setName($name) + { + if ($this->overrideName) { + throw new Forbidden('This node cannot be renamed'); + } - list($parentPath, ) = URLUtil::splitPath($this->path); - list(, $newName) = URLUtil::splitPath($name); + list($parentPath) = Uri\split($this->path); + list(, $newName) = Uri\split($name); - $newPath = $parentPath . '/' . $newName; + $newPath = $parentPath.'/'.$newName; rename($this->path, $newPath); $this->path = $newPath; - } /** - * Returns the last modification time, as a unix timestamp + * Returns the last modification time, as a unix timestamp. * * @return int */ - function getLastModified() { - + public function getLastModified() + { return filemtime($this->path); - } - } -- cgit v1.2.3