summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-12-03 11:03:17 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-12-29 09:07:36 +0100
commit73c7d0dc8156703341733b9c39c69d05263173da (patch)
treeb960b9acb15d29aa5dded5aaedbe07eda651ecc3 /lib/private/Files/Storage
parent083f3d23737b99fafec87c64df99e9c09cde71c7 (diff)
downloadnextcloud-server-73c7d0dc8156703341733b9c39c69d05263173da.tar.gz
nextcloud-server-73c7d0dc8156703341733b9c39c69d05263173da.zip
Bump icewind/streams from 0.7.1 to 0.7.2
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Files/Storage')
-rw-r--r--lib/private/Files/Storage/Common.php5
-rw-r--r--lib/private/Files/Storage/Wrapper/Encoding.php26
-rw-r--r--lib/private/Files/Storage/Wrapper/Jail.php24
-rw-r--r--lib/private/Files/Storage/Wrapper/Quota.php6
-rw-r--r--lib/private/Files/Storage/Wrapper/Wrapper.php28
5 files changed, 45 insertions, 44 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 6a530877f43..bddb1f4a294 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -630,8 +630,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
}
}
- if ($result and $preserveMtime) {
- $this->touch($targetInternalPath, $sourceStorage->filemtime($sourceInternalPath));
+ if ($result && $preserveMtime) {
+ $mtime = $sourceStorage->filemtime($sourceInternalPath);
+ $this->touch($targetInternalPath, is_int($mtime) ? $mtime : null);
}
if (!$result) {
diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php
index 02e82211dab..33a599ee469 100644
--- a/lib/private/Files/Storage/Wrapper/Encoding.php
+++ b/lib/private/Files/Storage/Wrapper/Encoding.php
@@ -156,7 +156,7 @@ class Encoding extends Wrapper {
* see https://www.php.net/manual/en/function.opendir.php
*
* @param string $path
- * @return resource
+ * @return resource|bool
*/
public function opendir($path) {
return $this->storage->opendir($this->findPathToUse($path));
@@ -187,7 +187,7 @@ class Encoding extends Wrapper {
* only the following keys are required in the result: size and mtime
*
* @param string $path
- * @return array
+ * @return array|bool
*/
public function stat($path) {
return $this->storage->stat($this->findPathToUse($path));
@@ -197,7 +197,7 @@ class Encoding extends Wrapper {
* see https://www.php.net/manual/en/function.filetype.php
*
* @param string $path
- * @return bool
+ * @return string|bool
*/
public function filetype($path) {
return $this->storage->filetype($this->findPathToUse($path));
@@ -208,7 +208,7 @@ class Encoding extends Wrapper {
* The result for filesize when called on a folder is required to be 0
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function filesize($path) {
return $this->storage->filesize($this->findPathToUse($path));
@@ -289,7 +289,7 @@ class Encoding extends Wrapper {
* see https://www.php.net/manual/en/function.filemtime.php
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function filemtime($path) {
return $this->storage->filemtime($this->findPathToUse($path));
@@ -299,7 +299,7 @@ class Encoding extends Wrapper {
* see https://www.php.net/manual/en/function.file_get_contents.php
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function file_get_contents($path) {
return $this->storage->file_get_contents($this->findPathToUse($path));
@@ -358,7 +358,7 @@ class Encoding extends Wrapper {
*
* @param string $path
* @param string $mode
- * @return resource
+ * @return resource|bool
*/
public function fopen($path, $mode) {
$result = $this->storage->fopen($this->findPathToUse($path), $mode);
@@ -373,7 +373,7 @@ class Encoding extends Wrapper {
* The mimetype for a folder is required to be "httpd/unix-directory"
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getMimeType($path) {
return $this->storage->getMimeType($this->findPathToUse($path));
@@ -385,7 +385,7 @@ class Encoding extends Wrapper {
* @param string $type
* @param string $path
* @param bool $raw
- * @return string
+ * @return string|bool
*/
public function hash($type, $path, $raw = false) {
return $this->storage->hash($type, $this->findPathToUse($path), $raw);
@@ -395,7 +395,7 @@ class Encoding extends Wrapper {
* see https://www.php.net/manual/en/function.free_space.php
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function free_space($path) {
return $this->storage->free_space($this->findPathToUse($path));
@@ -405,7 +405,7 @@ class Encoding extends Wrapper {
* search for occurrences of $query in file names
*
* @param string $query
- * @return array
+ * @return array|bool
*/
public function search($query) {
return $this->storage->search($query);
@@ -428,7 +428,7 @@ class Encoding extends Wrapper {
* The local version of the file can be temporary and doesn't have to be persistent across requests
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getLocalFile($path) {
return $this->storage->getLocalFile($this->findPathToUse($path));
@@ -480,7 +480,7 @@ class Encoding extends Wrapper {
* get the ETag for a file or folder
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getETag($path) {
return $this->storage->getETag($this->findPathToUse($path));
diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php
index 26ad82816c5..a534ec8a492 100644
--- a/lib/private/Files/Storage/Wrapper/Jail.php
+++ b/lib/private/Files/Storage/Wrapper/Jail.php
@@ -106,7 +106,7 @@ class Jail extends Wrapper {
* see https://www.php.net/manual/en/function.opendir.php
*
* @param string $path
- * @return resource
+ * @return resource|bool
*/
public function opendir($path) {
return $this->getWrapperStorage()->opendir($this->getUnjailedPath($path));
@@ -137,7 +137,7 @@ class Jail extends Wrapper {
* only the following keys are required in the result: size and mtime
*
* @param string $path
- * @return array
+ * @return array|bool
*/
public function stat($path) {
return $this->getWrapperStorage()->stat($this->getUnjailedPath($path));
@@ -158,7 +158,7 @@ class Jail extends Wrapper {
* The result for filesize when called on a folder is required to be 0
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function filesize($path) {
return $this->getWrapperStorage()->filesize($this->getUnjailedPath($path));
@@ -239,7 +239,7 @@ class Jail extends Wrapper {
* see https://www.php.net/manual/en/function.filemtime.php
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function filemtime($path) {
return $this->getWrapperStorage()->filemtime($this->getUnjailedPath($path));
@@ -249,7 +249,7 @@ class Jail extends Wrapper {
* see https://www.php.net/manual/en/function.file_get_contents.php
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function file_get_contents($path) {
return $this->getWrapperStorage()->file_get_contents($this->getUnjailedPath($path));
@@ -303,7 +303,7 @@ class Jail extends Wrapper {
*
* @param string $path
* @param string $mode
- * @return resource
+ * @return resource|bool
*/
public function fopen($path, $mode) {
return $this->getWrapperStorage()->fopen($this->getUnjailedPath($path), $mode);
@@ -314,7 +314,7 @@ class Jail extends Wrapper {
* The mimetype for a folder is required to be "httpd/unix-directory"
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getMimeType($path) {
return $this->getWrapperStorage()->getMimeType($this->getUnjailedPath($path));
@@ -326,7 +326,7 @@ class Jail extends Wrapper {
* @param string $type
* @param string $path
* @param bool $raw
- * @return string
+ * @return string|bool
*/
public function hash($type, $path, $raw = false) {
return $this->getWrapperStorage()->hash($type, $this->getUnjailedPath($path), $raw);
@@ -336,7 +336,7 @@ class Jail extends Wrapper {
* see https://www.php.net/manual/en/function.free_space.php
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function free_space($path) {
return $this->getWrapperStorage()->free_space($this->getUnjailedPath($path));
@@ -346,7 +346,7 @@ class Jail extends Wrapper {
* search for occurrences of $query in file names
*
* @param string $query
- * @return array
+ * @return array|bool
*/
public function search($query) {
return $this->getWrapperStorage()->search($query);
@@ -369,7 +369,7 @@ class Jail extends Wrapper {
* The local version of the file can be temporary and doesn't have to be persistent across requests
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getLocalFile($path) {
return $this->getWrapperStorage()->getLocalFile($this->getUnjailedPath($path));
@@ -432,7 +432,7 @@ class Jail extends Wrapper {
* get the ETag for a file or folder
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getETag($path) {
return $this->getWrapperStorage()->getETag($this->getUnjailedPath($path));
diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php
index 55fbbb0a60b..e9a6847e581 100644
--- a/lib/private/Files/Storage/Wrapper/Quota.php
+++ b/lib/private/Files/Storage/Wrapper/Quota.php
@@ -95,7 +95,7 @@ class Quota extends Wrapper {
* Get free space as limited by the quota
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function free_space($path) {
if ($this->quota < 0 || strpos($path, 'cache') === 0 || strpos($path, 'uploads') === 0) {
@@ -155,7 +155,7 @@ class Quota extends Wrapper {
*
* @param string $path
* @param string $mode
- * @return resource
+ * @return resource|bool
*/
public function fopen($path, $mode) {
$source = $this->storage->fopen($path, $mode);
@@ -163,7 +163,7 @@ class Quota extends Wrapper {
// don't apply quota for part files
if (!$this->isPartFile($path)) {
$free = $this->free_space($path);
- if ($source && $free >= 0 && $mode !== 'r' && $mode !== 'rb') {
+ if ($source && is_int($free) && $free >= 0 && $mode !== 'r' && $mode !== 'rb') {
// only apply quota for files, not metadata, trash or others
if ($this->shouldApplyQuota($path)) {
return \OC\Files\Stream\Quota::wrap($source, $free);
diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php
index 43e57c688d1..37549560343 100644
--- a/lib/private/Files/Storage/Wrapper/Wrapper.php
+++ b/lib/private/Files/Storage/Wrapper/Wrapper.php
@@ -97,7 +97,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* see https://www.php.net/manual/en/function.opendir.php
*
* @param string $path
- * @return resource
+ * @return resource|bool
*/
public function opendir($path) {
return $this->getWrapperStorage()->opendir($path);
@@ -128,7 +128,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* only the following keys are required in the result: size and mtime
*
* @param string $path
- * @return array
+ * @return array|bool
*/
public function stat($path) {
return $this->getWrapperStorage()->stat($path);
@@ -138,7 +138,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* see https://www.php.net/manual/en/function.filetype.php
*
* @param string $path
- * @return bool
+ * @return string|bool
*/
public function filetype($path) {
return $this->getWrapperStorage()->filetype($path);
@@ -149,7 +149,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* The result for filesize when called on a folder is required to be 0
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function filesize($path) {
return $this->getWrapperStorage()->filesize($path);
@@ -230,7 +230,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* see https://www.php.net/manual/en/function.filemtime.php
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function filemtime($path) {
return $this->getWrapperStorage()->filemtime($path);
@@ -240,7 +240,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* see https://www.php.net/manual/en/function.file_get_contents.php
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function file_get_contents($path) {
return $this->getWrapperStorage()->file_get_contents($path);
@@ -294,7 +294,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
*
* @param string $path
* @param string $mode
- * @return resource
+ * @return resource|bool
*/
public function fopen($path, $mode) {
return $this->getWrapperStorage()->fopen($path, $mode);
@@ -305,7 +305,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* The mimetype for a folder is required to be "httpd/unix-directory"
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getMimeType($path) {
return $this->getWrapperStorage()->getMimeType($path);
@@ -317,7 +317,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* @param string $type
* @param string $path
* @param bool $raw
- * @return string
+ * @return string|bool
*/
public function hash($type, $path, $raw = false) {
return $this->getWrapperStorage()->hash($type, $path, $raw);
@@ -327,7 +327,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* see https://www.php.net/manual/en/function.free_space.php
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function free_space($path) {
return $this->getWrapperStorage()->free_space($path);
@@ -337,7 +337,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* search for occurrences of $query in file names
*
* @param string $query
- * @return array
+ * @return array|bool
*/
public function search($query) {
return $this->getWrapperStorage()->search($query);
@@ -360,7 +360,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* The local version of the file can be temporary and doesn't have to be persistent across requests
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getLocalFile($path) {
return $this->getWrapperStorage()->getLocalFile($path);
@@ -458,7 +458,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* get the ETag for a file or folder
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function getETag($path) {
return $this->getWrapperStorage()->getETag($path);
@@ -513,7 +513,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* For now the returned array can hold the parameter url - in future more attributes might follow.
*
* @param string $path
- * @return array
+ * @return array|bool
*/
public function getDirectDownload($path) {
return $this->getWrapperStorage()->getDirectDownload($path);