Bläddra i källkod

Bump icewind/streams from 0.7.1 to 0.7.2

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tags/v21.0.0beta4
Christoph Wurst 3 år sedan
förälder
incheckning
73c7d0dc81
Inget konto är kopplat till bidragsgivarens mejladress

+ 1
- 1
3rdparty

Subproject commit aea1df9dcc0ae1b774e15edf07a470198b952e45
Subproject commit 8a030d70b84a7367c101bce29b1be044322c0a8f

+ 1
- 1
apps/dav/lib/Connector/Sabre/File.php Visa fil

} }


/** /**
* @return array|false
* @return array|bool
*/ */
public function getDirectDownload() { public function getDirectDownload() {
if (\OCP\App::isEnabled('encryption')) { if (\OCP\App::isEnabled('encryption')) {

+ 1
- 1
apps/files_external/lib/Lib/Storage/SMB.php Visa fil

/** /**
* @param string $path * @param string $path
* @param string $mode * @param string $mode
* @return resource|false
* @return resource|bool
*/ */
public function fopen($path, $mode) { public function fopen($path, $mode) {
$fullPath = $this->buildPath($path); $fullPath = $this->buildPath($path);

+ 35
- 92
build/psalm-baseline.xml Visa fil

</InvalidReturnType> </InvalidReturnType>
</file> </file>
<file src="apps/files_sharing/lib/SharedStorage.php"> <file src="apps/files_sharing/lib/SharedStorage.php">
<FalsableReturnStatement occurrences="5">
<code>$this-&gt;nonMaskedStorage-&gt;fopen($this-&gt;getUnjailedPath($path), $mode)</code>
<FalsableReturnStatement occurrences="1">
<code>$this-&gt;sourceRootInfo</code> <code>$this-&gt;sourceRootInfo</code>
<code>false</code>
<code>false</code>
<code>false</code>
</FalsableReturnStatement> </FalsableReturnStatement>
<InvalidNullableReturnType occurrences="1"> <InvalidNullableReturnType occurrences="1">
<code>ICacheEntry</code> <code>ICacheEntry</code>
<code>null</code> <code>null</code>
</NullArgument> </NullArgument>
</file> </file>
<file src="apps/workflowengine/lib/Check/FileMimeType.php">
<InvalidScalarArgument occurrences="1">
<code>$path</code>
</InvalidScalarArgument>
</file>
<file src="apps/workflowengine/lib/Check/FileSize.php"> <file src="apps/workflowengine/lib/Check/FileSize.php">
<FalsableReturnStatement occurrences="1"> <FalsableReturnStatement occurrences="1">
<code>$this-&gt;size</code> <code>$this-&gt;size</code>
<file src="core/routes.php"> <file src="core/routes.php">
<InvalidScope occurrences="2"> <InvalidScope occurrences="2">
<code>$this</code> <code>$this</code>
<code>$this</code>
<code>$this-&gt;create('core_ajax_update', '/core/ajax/update.php')</code>
</InvalidScope> </InvalidScope>
</file> </file>
<file src="core/templates/layout.public.php"> <file src="core/templates/layout.public.php">
<FalsableReturnStatement occurrences="1"> <FalsableReturnStatement occurrences="1">
<code>false</code> <code>false</code>
</FalsableReturnStatement> </FalsableReturnStatement>
<InvalidReturnStatement occurrences="1">
<InvalidReturnStatement occurrences="2">
<code>$this-&gt;tar-&gt;extractInString($path)</code> <code>$this-&gt;tar-&gt;extractInString($path)</code>
</InvalidReturnStatement> </InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<InvalidReturnType occurrences="2">
<code>resource</code>
<code>string</code> <code>string</code>
</InvalidReturnType> </InvalidReturnType>
<UndefinedDocblockClass occurrences="1"> <UndefinedDocblockClass occurrences="1">
<code>boolean|null</code> <code>boolean|null</code>
<code>boolean|null</code> <code>boolean|null</code>
</ImplementedReturnTypeMismatch> </ImplementedReturnTypeMismatch>
<InvalidReturnStatement occurrences="1"/>
<InvalidReturnType occurrences="1">
<code>resource</code>
</InvalidReturnType>
</file> </file>
<file src="lib/private/Authentication/LoginCredentials/Store.php"> <file src="lib/private/Authentication/LoginCredentials/Store.php">
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="1">
</InvalidReturnType> </InvalidReturnType>
</file> </file>
<file src="lib/private/Files/Storage/Wrapper/Encoding.php"> <file src="lib/private/Files/Storage/Wrapper/Encoding.php">
<FalsableReturnStatement occurrences="12">
<code>$result</code>
<code>$this-&gt;storage-&gt;file_get_contents($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;filemtime($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;filesize($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;free_space($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;getETag($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;getLocalFile($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;getMimeType($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;hash($type, $this-&gt;findPathToUse($path), $raw)</code>
<code>$this-&gt;storage-&gt;opendir($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;search($query)</code>
<code>$this-&gt;storage-&gt;stat($this-&gt;findPathToUse($path))</code>
</FalsableReturnStatement>
<ImplementedReturnTypeMismatch occurrences="1">
<code>bool</code>
</ImplementedReturnTypeMismatch>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;storage-&gt;filetype($this-&gt;findPathToUse($path))</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>bool</code>
</InvalidReturnType>
<UndefinedInterfaceMethod occurrences="13"> <UndefinedInterfaceMethod occurrences="13">
<code>$this-&gt;namesCache</code> <code>$this-&gt;namesCache</code>
<code>$this-&gt;namesCache</code> <code>$this-&gt;namesCache</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="lib/private/Files/Storage/Wrapper/Encryption.php"> <file src="lib/private/Files/Storage/Wrapper/Encryption.php">
<FalsableReturnStatement occurrences="5">
<code>$stat</code>
<code>$this-&gt;storage-&gt;file_get_contents($path)</code>
<code>$this-&gt;storage-&gt;filesize($path)</code>
<code>$this-&gt;storage-&gt;getLocalFile($path)</code>
<FalsableReturnStatement occurrences="1">
<code>false</code> <code>false</code>
</FalsableReturnStatement> </FalsableReturnStatement>
<ImplementedReturnTypeMismatch occurrences="1">
<code>resource|bool</code>
</ImplementedReturnTypeMismatch>
<InvalidArgument occurrences="2"> <InvalidArgument occurrences="2">
<code>$source</code> <code>$source</code>
<code>$target</code> <code>$target</code>
<code>$result</code> <code>$result</code>
<code>$result</code> <code>$result</code>
</InvalidOperand> </InvalidOperand>
<InvalidReturnStatement occurrences="1">
<InvalidReturnStatement occurrences="5">
<code>$newUnencryptedSize</code> <code>$newUnencryptedSize</code>
<code>$stat</code>
<code>$this-&gt;storage-&gt;file_get_contents($path)</code>
<code>$this-&gt;storage-&gt;filesize($path)</code>
<code>$this-&gt;storage-&gt;getLocalFile($path)</code>
</InvalidReturnStatement> </InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<InvalidReturnType occurrences="4">
<code>array</code>
<code>int</code> <code>int</code>
<code>string</code>
<code>string</code>
</InvalidReturnType> </InvalidReturnType>
<InvalidScalarArgument occurrences="2">
<InvalidScalarArgument occurrences="5">
<code>$lastChunkPos</code> <code>$lastChunkPos</code>
<code>$newUnencryptedSize</code> <code>$newUnencryptedSize</code>
<code>$size</code>
<code>$size</code>
<code>$sourceStorage-&gt;filemtime($sourceInternalPath)</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<NullableReturnStatement occurrences="1"> <NullableReturnStatement occurrences="1">
<code>null</code> <code>null</code>
</NullableReturnStatement> </NullableReturnStatement>
</file> </file>
<file src="lib/private/Files/Storage/Wrapper/Jail.php"> <file src="lib/private/Files/Storage/Wrapper/Jail.php">
<FalsableReturnStatement occurrences="12">
<code>$this-&gt;getWrapperStorage()-&gt;file_get_contents($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;filemtime($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;filesize($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;fopen($this-&gt;getUnjailedPath($path), $mode)</code>
<code>$this-&gt;getWrapperStorage()-&gt;free_space($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;getETag($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;getLocalFile($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;getMimeType($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;hash($type, $this-&gt;getUnjailedPath($path), $raw)</code>
<code>$this-&gt;getWrapperStorage()-&gt;opendir($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;search($query)</code>
<code>$this-&gt;getWrapperStorage()-&gt;stat($this-&gt;getUnjailedPath($path))</code>
</FalsableReturnStatement>
<ImplementedReturnTypeMismatch occurrences="1">
<code>bool</code>
</ImplementedReturnTypeMismatch>
<InvalidReturnStatement occurrences="1"> <InvalidReturnStatement occurrences="1">
<code>$this-&gt;getWrapperStorage()-&gt;filetype($this-&gt;getUnjailedPath($path))</code> <code>$this-&gt;getWrapperStorage()-&gt;filetype($this-&gt;getUnjailedPath($path))</code>
</InvalidReturnStatement> </InvalidReturnStatement>
<code>bool</code> <code>bool</code>
</InvalidReturnType> </InvalidReturnType>
</file> </file>
<file src="lib/private/Files/Storage/Wrapper/PermissionsMask.php">
<FalsableReturnStatement occurrences="1">
<code>$this-&gt;checkMask($permissions) ? parent::fopen($path, $mode) : false</code>
</FalsableReturnStatement>
</file>
<file src="lib/private/Files/Storage/Wrapper/Quota.php"> <file src="lib/private/Files/Storage/Wrapper/Quota.php">
<FalsableReturnStatement occurrences="2">
<code>$source</code>
<code>$this-&gt;storage-&gt;free_space($path)</code>
</FalsableReturnStatement>
<InvalidReturnStatement occurrences="1"> <InvalidReturnStatement occurrences="1">
<code>$extension === 'part'</code> <code>$extension === 'part'</code>
</InvalidReturnStatement> </InvalidReturnStatement>
</ParamNameMismatch> </ParamNameMismatch>
</file> </file>
<file src="lib/private/Files/Storage/Wrapper/Wrapper.php"> <file src="lib/private/Files/Storage/Wrapper/Wrapper.php">
<FalsableReturnStatement occurrences="13">
<code>$this-&gt;getWrapperStorage()-&gt;file_get_contents($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;filemtime($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;filesize($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;fopen($path, $mode)</code>
<code>$this-&gt;getWrapperStorage()-&gt;free_space($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getDirectDownload($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getETag($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getLocalFile($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getMimeType($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;hash($type, $path, $raw)</code>
<code>$this-&gt;getWrapperStorage()-&gt;opendir($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;search($query)</code>
<code>$this-&gt;getWrapperStorage()-&gt;stat($path)</code>
</FalsableReturnStatement>
<ImplementedReturnTypeMismatch occurrences="1">
<code>bool</code>
</ImplementedReturnTypeMismatch>
<InvalidReturnStatement occurrences="2">
<code>$this-&gt;getWrapperStorage()-&gt;filetype($path)</code>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;getWrapperStorage()-&gt;test()</code> <code>$this-&gt;getWrapperStorage()-&gt;test()</code>
</InvalidReturnStatement> </InvalidReturnStatement>
<InvalidReturnType occurrences="2">
<code>bool</code>
<InvalidReturnType occurrences="1">
<code>true</code> <code>true</code>
</InvalidReturnType> </InvalidReturnType>
</file> </file>
</InvalidReturnType> </InvalidReturnType>
</file> </file>
<file src="lib/private/Preview/ProviderV2.php"> <file src="lib/private/Preview/ProviderV2.php">
<FalsableReturnStatement occurrences="1">
<InvalidReturnStatement occurrences="1">
<code>$file-&gt;getStorage()-&gt;getLocalFile($file-&gt;getInternalPath())</code> <code>$file-&gt;getStorage()-&gt;getLocalFile($file-&gt;getInternalPath())</code>
</FalsableReturnStatement>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>string</code>
</InvalidReturnType>
</file> </file>
<file src="lib/private/Preview/SVG.php"> <file src="lib/private/Preview/SVG.php">
<ImplicitToStringCast occurrences="1"> <ImplicitToStringCast occurrences="1">

+ 5
- 1
lib/composer/composer/installed.json Visa fil

[]
{
"packages": [],
"dev": false,
"dev-package-names": []
}

+ 4
- 3
lib/private/Files/ObjectStore/StorageObjectStore.php Visa fil



use OCP\Files\ObjectStore\IObjectStore; use OCP\Files\ObjectStore\IObjectStore;
use OCP\Files\Storage\IStorage; use OCP\Files\Storage\IStorage;
use function is_resource;


/** /**
* Object store that wraps a storage backend, mostly for testing purposes * Object store that wraps a storage backend, mostly for testing purposes
*/ */
public function readObject($urn) { public function readObject($urn) {
$handle = $this->storage->fopen($urn, 'r'); $handle = $this->storage->fopen($urn, 'r');
if ($handle) {
if (is_resource($handle)) {
return $handle; return $handle;
} else {
throw new \Exception();
} }

throw new \Exception();
} }


/** /**

+ 1
- 1
lib/private/Files/SimpleFS/NewSimpleFile.php Visa fil

/** /**
* Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
* *
* @return resource
* @return resource|bool
* @throws \OCP\Files\NotPermittedException * @throws \OCP\Files\NotPermittedException
* @since 14.0.0 * @since 14.0.0
*/ */

+ 3
- 2
lib/private/Files/Storage/Common.php Visa fil

} }
} }


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) { if (!$result) {

+ 13
- 13
lib/private/Files/Storage/Wrapper/Encoding.php Visa fil

* see https://www.php.net/manual/en/function.opendir.php * see https://www.php.net/manual/en/function.opendir.php
* *
* @param string $path * @param string $path
* @return resource
* @return resource|bool
*/ */
public function opendir($path) { public function opendir($path) {
return $this->storage->opendir($this->findPathToUse($path)); return $this->storage->opendir($this->findPathToUse($path));
* only the following keys are required in the result: size and mtime * only the following keys are required in the result: size and mtime
* *
* @param string $path * @param string $path
* @return array
* @return array|bool
*/ */
public function stat($path) { public function stat($path) {
return $this->storage->stat($this->findPathToUse($path)); return $this->storage->stat($this->findPathToUse($path));
* see https://www.php.net/manual/en/function.filetype.php * see https://www.php.net/manual/en/function.filetype.php
* *
* @param string $path * @param string $path
* @return bool
* @return string|bool
*/ */
public function filetype($path) { public function filetype($path) {
return $this->storage->filetype($this->findPathToUse($path)); return $this->storage->filetype($this->findPathToUse($path));
* The result for filesize when called on a folder is required to be 0 * The result for filesize when called on a folder is required to be 0
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function filesize($path) { public function filesize($path) {
return $this->storage->filesize($this->findPathToUse($path)); return $this->storage->filesize($this->findPathToUse($path));
* see https://www.php.net/manual/en/function.filemtime.php * see https://www.php.net/manual/en/function.filemtime.php
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function filemtime($path) { public function filemtime($path) {
return $this->storage->filemtime($this->findPathToUse($path)); return $this->storage->filemtime($this->findPathToUse($path));
* see https://www.php.net/manual/en/function.file_get_contents.php * see https://www.php.net/manual/en/function.file_get_contents.php
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function file_get_contents($path) { public function file_get_contents($path) {
return $this->storage->file_get_contents($this->findPathToUse($path)); return $this->storage->file_get_contents($this->findPathToUse($path));
* *
* @param string $path * @param string $path
* @param string $mode * @param string $mode
* @return resource
* @return resource|bool
*/ */
public function fopen($path, $mode) { public function fopen($path, $mode) {
$result = $this->storage->fopen($this->findPathToUse($path), $mode); $result = $this->storage->fopen($this->findPathToUse($path), $mode);
* The mimetype for a folder is required to be "httpd/unix-directory" * The mimetype for a folder is required to be "httpd/unix-directory"
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getMimeType($path) { public function getMimeType($path) {
return $this->storage->getMimeType($this->findPathToUse($path)); return $this->storage->getMimeType($this->findPathToUse($path));
* @param string $type * @param string $type
* @param string $path * @param string $path
* @param bool $raw * @param bool $raw
* @return string
* @return string|bool
*/ */
public function hash($type, $path, $raw = false) { public function hash($type, $path, $raw = false) {
return $this->storage->hash($type, $this->findPathToUse($path), $raw); return $this->storage->hash($type, $this->findPathToUse($path), $raw);
* see https://www.php.net/manual/en/function.free_space.php * see https://www.php.net/manual/en/function.free_space.php
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function free_space($path) { public function free_space($path) {
return $this->storage->free_space($this->findPathToUse($path)); return $this->storage->free_space($this->findPathToUse($path));
* search for occurrences of $query in file names * search for occurrences of $query in file names
* *
* @param string $query * @param string $query
* @return array
* @return array|bool
*/ */
public function search($query) { public function search($query) {
return $this->storage->search($query); return $this->storage->search($query);
* The local version of the file can be temporary and doesn't have to be persistent across requests * The local version of the file can be temporary and doesn't have to be persistent across requests
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getLocalFile($path) { public function getLocalFile($path) {
return $this->storage->getLocalFile($this->findPathToUse($path)); return $this->storage->getLocalFile($this->findPathToUse($path));
* get the ETag for a file or folder * get the ETag for a file or folder
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getETag($path) { public function getETag($path) {
return $this->storage->getETag($this->findPathToUse($path)); return $this->storage->getETag($this->findPathToUse($path));

+ 12
- 12
lib/private/Files/Storage/Wrapper/Jail.php Visa fil

* see https://www.php.net/manual/en/function.opendir.php * see https://www.php.net/manual/en/function.opendir.php
* *
* @param string $path * @param string $path
* @return resource
* @return resource|bool
*/ */
public function opendir($path) { public function opendir($path) {
return $this->getWrapperStorage()->opendir($this->getUnjailedPath($path)); return $this->getWrapperStorage()->opendir($this->getUnjailedPath($path));
* only the following keys are required in the result: size and mtime * only the following keys are required in the result: size and mtime
* *
* @param string $path * @param string $path
* @return array
* @return array|bool
*/ */
public function stat($path) { public function stat($path) {
return $this->getWrapperStorage()->stat($this->getUnjailedPath($path)); return $this->getWrapperStorage()->stat($this->getUnjailedPath($path));
* The result for filesize when called on a folder is required to be 0 * The result for filesize when called on a folder is required to be 0
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function filesize($path) { public function filesize($path) {
return $this->getWrapperStorage()->filesize($this->getUnjailedPath($path)); return $this->getWrapperStorage()->filesize($this->getUnjailedPath($path));
* see https://www.php.net/manual/en/function.filemtime.php * see https://www.php.net/manual/en/function.filemtime.php
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function filemtime($path) { public function filemtime($path) {
return $this->getWrapperStorage()->filemtime($this->getUnjailedPath($path)); return $this->getWrapperStorage()->filemtime($this->getUnjailedPath($path));
* see https://www.php.net/manual/en/function.file_get_contents.php * see https://www.php.net/manual/en/function.file_get_contents.php
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function file_get_contents($path) { public function file_get_contents($path) {
return $this->getWrapperStorage()->file_get_contents($this->getUnjailedPath($path)); return $this->getWrapperStorage()->file_get_contents($this->getUnjailedPath($path));
* *
* @param string $path * @param string $path
* @param string $mode * @param string $mode
* @return resource
* @return resource|bool
*/ */
public function fopen($path, $mode) { public function fopen($path, $mode) {
return $this->getWrapperStorage()->fopen($this->getUnjailedPath($path), $mode); return $this->getWrapperStorage()->fopen($this->getUnjailedPath($path), $mode);
* The mimetype for a folder is required to be "httpd/unix-directory" * The mimetype for a folder is required to be "httpd/unix-directory"
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getMimeType($path) { public function getMimeType($path) {
return $this->getWrapperStorage()->getMimeType($this->getUnjailedPath($path)); return $this->getWrapperStorage()->getMimeType($this->getUnjailedPath($path));
* @param string $type * @param string $type
* @param string $path * @param string $path
* @param bool $raw * @param bool $raw
* @return string
* @return string|bool
*/ */
public function hash($type, $path, $raw = false) { public function hash($type, $path, $raw = false) {
return $this->getWrapperStorage()->hash($type, $this->getUnjailedPath($path), $raw); return $this->getWrapperStorage()->hash($type, $this->getUnjailedPath($path), $raw);
* see https://www.php.net/manual/en/function.free_space.php * see https://www.php.net/manual/en/function.free_space.php
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function free_space($path) { public function free_space($path) {
return $this->getWrapperStorage()->free_space($this->getUnjailedPath($path)); return $this->getWrapperStorage()->free_space($this->getUnjailedPath($path));
* search for occurrences of $query in file names * search for occurrences of $query in file names
* *
* @param string $query * @param string $query
* @return array
* @return array|bool
*/ */
public function search($query) { public function search($query) {
return $this->getWrapperStorage()->search($query); return $this->getWrapperStorage()->search($query);
* The local version of the file can be temporary and doesn't have to be persistent across requests * The local version of the file can be temporary and doesn't have to be persistent across requests
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getLocalFile($path) { public function getLocalFile($path) {
return $this->getWrapperStorage()->getLocalFile($this->getUnjailedPath($path)); return $this->getWrapperStorage()->getLocalFile($this->getUnjailedPath($path));
* get the ETag for a file or folder * get the ETag for a file or folder
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getETag($path) { public function getETag($path) {
return $this->getWrapperStorage()->getETag($this->getUnjailedPath($path)); return $this->getWrapperStorage()->getETag($this->getUnjailedPath($path));

+ 3
- 3
lib/private/Files/Storage/Wrapper/Quota.php Visa fil

* Get free space as limited by the quota * Get free space as limited by the quota
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function free_space($path) { public function free_space($path) {
if ($this->quota < 0 || strpos($path, 'cache') === 0 || strpos($path, 'uploads') === 0) { if ($this->quota < 0 || strpos($path, 'cache') === 0 || strpos($path, 'uploads') === 0) {
* *
* @param string $path * @param string $path
* @param string $mode * @param string $mode
* @return resource
* @return resource|bool
*/ */
public function fopen($path, $mode) { public function fopen($path, $mode) {
$source = $this->storage->fopen($path, $mode); $source = $this->storage->fopen($path, $mode);
// don't apply quota for part files // don't apply quota for part files
if (!$this->isPartFile($path)) { if (!$this->isPartFile($path)) {
$free = $this->free_space($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 // only apply quota for files, not metadata, trash or others
if ($this->shouldApplyQuota($path)) { if ($this->shouldApplyQuota($path)) {
return \OC\Files\Stream\Quota::wrap($source, $free); return \OC\Files\Stream\Quota::wrap($source, $free);

+ 14
- 14
lib/private/Files/Storage/Wrapper/Wrapper.php Visa fil

* see https://www.php.net/manual/en/function.opendir.php * see https://www.php.net/manual/en/function.opendir.php
* *
* @param string $path * @param string $path
* @return resource
* @return resource|bool
*/ */
public function opendir($path) { public function opendir($path) {
return $this->getWrapperStorage()->opendir($path); return $this->getWrapperStorage()->opendir($path);
* only the following keys are required in the result: size and mtime * only the following keys are required in the result: size and mtime
* *
* @param string $path * @param string $path
* @return array
* @return array|bool
*/ */
public function stat($path) { public function stat($path) {
return $this->getWrapperStorage()->stat($path); return $this->getWrapperStorage()->stat($path);
* see https://www.php.net/manual/en/function.filetype.php * see https://www.php.net/manual/en/function.filetype.php
* *
* @param string $path * @param string $path
* @return bool
* @return string|bool
*/ */
public function filetype($path) { public function filetype($path) {
return $this->getWrapperStorage()->filetype($path); return $this->getWrapperStorage()->filetype($path);
* The result for filesize when called on a folder is required to be 0 * The result for filesize when called on a folder is required to be 0
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function filesize($path) { public function filesize($path) {
return $this->getWrapperStorage()->filesize($path); return $this->getWrapperStorage()->filesize($path);
* see https://www.php.net/manual/en/function.filemtime.php * see https://www.php.net/manual/en/function.filemtime.php
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function filemtime($path) { public function filemtime($path) {
return $this->getWrapperStorage()->filemtime($path); return $this->getWrapperStorage()->filemtime($path);
* see https://www.php.net/manual/en/function.file_get_contents.php * see https://www.php.net/manual/en/function.file_get_contents.php
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function file_get_contents($path) { public function file_get_contents($path) {
return $this->getWrapperStorage()->file_get_contents($path); return $this->getWrapperStorage()->file_get_contents($path);
* *
* @param string $path * @param string $path
* @param string $mode * @param string $mode
* @return resource
* @return resource|bool
*/ */
public function fopen($path, $mode) { public function fopen($path, $mode) {
return $this->getWrapperStorage()->fopen($path, $mode); return $this->getWrapperStorage()->fopen($path, $mode);
* The mimetype for a folder is required to be "httpd/unix-directory" * The mimetype for a folder is required to be "httpd/unix-directory"
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getMimeType($path) { public function getMimeType($path) {
return $this->getWrapperStorage()->getMimeType($path); return $this->getWrapperStorage()->getMimeType($path);
* @param string $type * @param string $type
* @param string $path * @param string $path
* @param bool $raw * @param bool $raw
* @return string
* @return string|bool
*/ */
public function hash($type, $path, $raw = false) { public function hash($type, $path, $raw = false) {
return $this->getWrapperStorage()->hash($type, $path, $raw); return $this->getWrapperStorage()->hash($type, $path, $raw);
* see https://www.php.net/manual/en/function.free_space.php * see https://www.php.net/manual/en/function.free_space.php
* *
* @param string $path * @param string $path
* @return int
* @return int|bool
*/ */
public function free_space($path) { public function free_space($path) {
return $this->getWrapperStorage()->free_space($path); return $this->getWrapperStorage()->free_space($path);
* search for occurrences of $query in file names * search for occurrences of $query in file names
* *
* @param string $query * @param string $query
* @return array
* @return array|bool
*/ */
public function search($query) { public function search($query) {
return $this->getWrapperStorage()->search($query); return $this->getWrapperStorage()->search($query);
* The local version of the file can be temporary and doesn't have to be persistent across requests * The local version of the file can be temporary and doesn't have to be persistent across requests
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getLocalFile($path) { public function getLocalFile($path) {
return $this->getWrapperStorage()->getLocalFile($path); return $this->getWrapperStorage()->getLocalFile($path);
* get the ETag for a file or folder * get the ETag for a file or folder
* *
* @param string $path * @param string $path
* @return string
* @return string|bool
*/ */
public function getETag($path) { public function getETag($path) {
return $this->getWrapperStorage()->getETag($path); return $this->getWrapperStorage()->getETag($path);
* For now the returned array can hold the parameter url - in future more attributes might follow. * For now the returned array can hold the parameter url - in future more attributes might follow.
* *
* @param string $path * @param string $path
* @return array
* @return array|bool
*/ */
public function getDirectDownload($path) { public function getDirectDownload($path) {
return $this->getWrapperStorage()->getDirectDownload($path); return $this->getWrapperStorage()->getDirectDownload($path);

+ 27
- 8
lib/private/Files/Stream/Encryption.php Visa fil



use Icewind\Streams\Wrapper; use Icewind\Streams\Wrapper;
use OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException; use OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException;
use function is_array;
use function stream_context_create;


class Encryption extends Wrapper { class Encryption extends Wrapper {


/** /**
* add stream wrapper * add stream wrapper
* *
* @param resource $source
* @param resource|int $source
* @param resource|array $context
* @param string|null $protocol
* @param string|null $class
* @param string $mode * @param string $mode
* @param resource $context
* @param string $protocol
* @param string $class
* @return resource * @return resource
* @throws \BadMethodCallException * @throws \BadMethodCallException
*/ */
protected static function wrapSource($source, $context, $protocol, $class, $mode = 'r+') {
protected static function wrapSource($source, $context = [], $protocol = null, $class = null, $mode = 'r+') {
try { try {
if ($protocol === null) {
$protocol = self::getProtocol($class);
}

stream_wrapper_register($protocol, $class); stream_wrapper_register($protocol, $class);
$context = self::buildContext($protocol, $context, $source);
if (self::isDirectoryHandle($source)) { if (self::isDirectoryHandle($source)) {
$wrapped = opendir($protocol . '://', $context); $wrapped = opendir($protocol . '://', $context);
} else { } else {
return $wrapped; return $wrapped;
} }


/**
* @todo this is a copy of \Icewind\Streams\WrapperHandler::buildContext -> combine to one shared method?
*/
private static function buildContext($protocol, $context, $source) {
if (is_array($context)) {
$context['source'] = $source;
return stream_context_create([$protocol => $context]);
}

return $context;
}

/** /**
* Load the source from the stream context and return the context options * Load the source from the stream context and return the context options
* *
* @param string $name
* @param string|null $name
* @return array * @return array
* @throws \BadMethodCallException * @throws \BadMethodCallException
*/ */
protected function loadContext($name) {
protected function loadContext($name = null) {
$context = parent::loadContext($name); $context = parent::loadContext($name);


foreach ($this->expectedContextProperties as $property) { foreach ($this->expectedContextProperties as $property) {
} }
return $result; return $result;
} }
/** /**
* stream_read_block * stream_read_block
* *

+ 1
- 1
lib/private/Files/Stream/Quota.php Visa fil

/** /**
* @param resource $stream * @param resource $stream
* @param int $limit * @param int $limit
* @return resource
* @return bool|resource
*/ */
public static function wrap($stream, $limit) { public static function wrap($stream, $limit) {
$context = stream_context_create([ $context = stream_context_create([

+ 2
- 1
lib/private/Repair/Owncloud/MoveAvatarsBackgroundJob.php Visa fil

use OCP\IUser; use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use function is_resource;


class MoveAvatarsBackgroundJob extends QueuedJob { class MoveAvatarsBackgroundJob extends QueuedJob {


try { try {
$avatarPath = $path . '/avatar.' . $this->getExtension($path); $avatarPath = $path . '/avatar.' . $this->getExtension($path);
$resource = $this->owncloudAvatarStorage->fopen($avatarPath, 'r'); $resource = $this->owncloudAvatarStorage->fopen($avatarPath, 'r');
if ($resource) {
if (is_resource($resource)) {
$avatar->set($resource); $avatar->set($resource);
fclose($resource); fclose($resource);
} else { } else {

+ 1
- 1
lib/public/Files/SimpleFS/ISimpleFile.php Visa fil

/** /**
* Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
* *
* @return resource
* @return resource|bool
* @throws \OCP\Files\NotPermittedException * @throws \OCP\Files\NotPermittedException
* @since 14.0.0 * @since 14.0.0
*/ */

+ 14
- 14
lib/public/Files/Storage.php Visa fil

* see https://www.php.net/manual/en/function.opendir.php * see https://www.php.net/manual/en/function.opendir.php
* *
* @param string $path * @param string $path
* @return resource|false
* @return resource|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function opendir($path); public function opendir($path);
* only the following keys are required in the result: size and mtime * only the following keys are required in the result: size and mtime
* *
* @param string $path * @param string $path
* @return array|false
* @return array|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function stat($path); public function stat($path);
* see https://www.php.net/manual/en/function.filetype.php * see https://www.php.net/manual/en/function.filetype.php
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function filetype($path); public function filetype($path);
* The result for filesize when called on a folder is required to be 0 * The result for filesize when called on a folder is required to be 0
* *
* @param string $path * @param string $path
* @return int|false
* @return int|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function filesize($path); public function filesize($path);
* see https://www.php.net/manual/en/function.filemtime.php * see https://www.php.net/manual/en/function.filemtime.php
* *
* @param string $path * @param string $path
* @return int|false
* @return int|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function filemtime($path); public function filemtime($path);
* see https://www.php.net/manual/en/function.file_get_contents.php * see https://www.php.net/manual/en/function.file_get_contents.php
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function file_get_contents($path); public function file_get_contents($path);
* *
* @param string $path * @param string $path
* @param string $mode * @param string $mode
* @return resource|false
* @return resource|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function fopen($path, $mode); public function fopen($path, $mode);
* The mimetype for a folder is required to be "httpd/unix-directory" * The mimetype for a folder is required to be "httpd/unix-directory"
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function getMimeType($path); public function getMimeType($path);
* @param string $type * @param string $type
* @param string $path * @param string $path
* @param bool $raw * @param bool $raw
* @return string|false
* @return string|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function hash($type, $path, $raw = false); public function hash($type, $path, $raw = false);
* see https://www.php.net/manual/en/function.free_space.php * see https://www.php.net/manual/en/function.free_space.php
* *
* @param string $path * @param string $path
* @return int|false
* @return int|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function free_space($path); public function free_space($path);
* search for occurrences of $query in file names * search for occurrences of $query in file names
* *
* @param string $query * @param string $query
* @return array|false
* @return array|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function search($query); public function search($query);
* The local version of the file can be temporary and doesn't have to be persistent across requests * The local version of the file can be temporary and doesn't have to be persistent across requests
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function getLocalFile($path); public function getLocalFile($path);
* get the ETag for a file or folder * get the ETag for a file or folder
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 6.0.0 * @since 6.0.0
*/ */
public function getETag($path); public function getETag($path);
* For now the returned array can hold the parameter url - in future more attributes might follow. * For now the returned array can hold the parameter url - in future more attributes might follow.
* *
* @param string $path * @param string $path
* @return array|false
* @return array|bool
* @since 8.0.0 * @since 8.0.0
*/ */
public function getDirectDownload($path); public function getDirectDownload($path);

+ 13
- 13
lib/public/Files/Storage/IStorage.php Visa fil

* see https://www.php.net/manual/en/function.opendir.php * see https://www.php.net/manual/en/function.opendir.php
* *
* @param string $path * @param string $path
* @return resource|false
* @return resource|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function opendir($path); public function opendir($path);
* only the following keys are required in the result: size and mtime * only the following keys are required in the result: size and mtime
* *
* @param string $path * @param string $path
* @return array|false
* @return array|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function stat($path); public function stat($path);
* see https://www.php.net/manual/en/function.filetype.php * see https://www.php.net/manual/en/function.filetype.php
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function filetype($path); public function filetype($path);
* The result for filesize when called on a folder is required to be 0 * The result for filesize when called on a folder is required to be 0
* *
* @param string $path * @param string $path
* @return int|false
* @return int|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function filesize($path); public function filesize($path);
* see https://www.php.net/manual/en/function.filemtime.php * see https://www.php.net/manual/en/function.filemtime.php
* *
* @param string $path * @param string $path
* @return int|false
* @return int|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function filemtime($path); public function filemtime($path);
* see https://www.php.net/manual/en/function.file_get_contents.php * see https://www.php.net/manual/en/function.file_get_contents.php
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function file_get_contents($path); public function file_get_contents($path);
* *
* @param string $path * @param string $path
* @param string $mode * @param string $mode
* @return resource|false
* @return resource|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function fopen($path, $mode); public function fopen($path, $mode);
* The mimetype for a folder is required to be "httpd/unix-directory" * The mimetype for a folder is required to be "httpd/unix-directory"
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function getMimeType($path); public function getMimeType($path);
* @param string $type * @param string $type
* @param string $path * @param string $path
* @param bool $raw * @param bool $raw
* @return string|false
* @return string|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function hash($type, $path, $raw = false); public function hash($type, $path, $raw = false);
* see https://www.php.net/manual/en/function.free_space.php * see https://www.php.net/manual/en/function.free_space.php
* *
* @param string $path * @param string $path
* @return int|false
* @return int|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function free_space($path); public function free_space($path);
* The local version of the file can be temporary and doesn't have to be persistent across requests * The local version of the file can be temporary and doesn't have to be persistent across requests
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function getLocalFile($path); public function getLocalFile($path);
* get the ETag for a file or folder * get the ETag for a file or folder
* *
* @param string $path * @param string $path
* @return string|false
* @return string|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function getETag($path); public function getETag($path);
* For now the returned array can hold the parameter url - in future more attributes might follow. * For now the returned array can hold the parameter url - in future more attributes might follow.
* *
* @param string $path * @param string $path
* @return array|false
* @return array|bool
* @since 9.0.0 * @since 9.0.0
*/ */
public function getDirectDownload($path); public function getDirectDownload($path);

Laddar…
Avbryt
Spara