Commit Graph

57 Commits (a1c8b6e9eb6543cde93ec2fb8be2fddfff0f54d2)

Author SHA1 Message Date
John Molakvoæ a1c8b6e9eb
Merge pull request #28768 from nextcloud/check-file-exists 3 years ago
acsfer 98eac0fc05
Simplify :) 3 years ago
acsfer 8a8df49bc0
Replace `file_exists()` method by `is_file()` 3 years ago
acsfer 3a25183b66 Get `filesize()` if `file_exists()`
Should make sense.
3 years ago
Daniel Kesselberg e60a829b42
explicitly close source stream on local storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
3 years ago
Rid 0469acfb20 Fix scanner mistaking socket files for directories
Signed-off-by: Rid <rid@cylo.io>
3 years ago
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
3 years ago
Roeland Jago Douma f3738eeff7
Merge pull request #25280 from nextcloud/explicit-file-permissions
Set umask before operations that create local files
3 years ago
Robin Appelman aee4caed07
show better error messages when a file with a forbidden path is encountered
Signed-off-by: Robin Appelman <robin@icewind.nl>
3 years ago
Robin Appelman e5dc1a8085
Set umask before operations that create local files
this solves issues where "other php stuff" is messing with the umask

Signed-off-by: Robin Appelman <robin@icewind.nl>
3 years ago
Robin Appelman d182043e83
explicitly set permissions on newly created folders
this works around any `umask` that might be set and limiting the folder permissions

Signed-off-by: Robin Appelman <robin@icewind.nl>
3 years ago
Johannes Leuker ac88bcbd5f Add 'allow Symlinks' as an option to config.php
Signed-off-by: Johannes Leuker <j.leuker@hosting.de>
3 years ago
Julius Härtl 5094e29ebd
Merge pull request #24594 from kofemann/dcache 3 years ago
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
3 years ago
Tigran Mkrtchyan f3513f3fe4 files: Local#writeStream should use it's own file_put_contents
The OC\Files\Storage\Local#writeStream use system provided file_put_contents.
However, it overrides file_put_contents, thus expects that the default behaviour
can be different.

Use Local#file_put_contents in writeStream to benefit from class specific functionality.

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
3 years ago
aler9 ac0c7a8fe0 Fix file size computation on 32bit platforms
Signed-off-by: aler9 <46489434+aler9@users.noreply.github.com>
4 years ago
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Morris Jobke ae9ecd521f
Merge pull request #21677 from J0WI/clearstatcache-on-rmdir
Do clearstatcache() on rmdir
4 years ago
Robin Appelman ad7798f9c9
use exceptions for error signaling in writeStream
this remove the ambiguity when writing zero length files

Signed-off-by: Robin Appelman <robin@icewind.nl>
4 years ago
J0WI 356bc50420 Only clear the realpath cache
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
4 years ago
J0WI ea08a01999 clearstatcache() on rmdir
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
4 years ago
Roeland Jago Douma 6b26744787
Clear the statscache before fetching the metadata
Else if a lot of writes happen. It might happen that an old stat result
is used. Resulting in a wrong file size for the file. For example the
text app when a lot of people edit at the same time.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
4 years ago
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Robin Appelman 9735b5d61f
Add method to storage backends to get directory content with metadata
Currently you need to use `opendir` and then call `getMetadata` for
every file, which adds overhead because most storage backends already
get the metadata when doing the `opendir`.

While storagebackends can (and do) use caching to relief this problem,
this adds cache invalidation dificulties and only a limited number of
items are generally cached (to prevent memory usage exploding when
scanning large storages)

With this new methods storage backends can use the child metadata they
got from listing the folder to return metadata without having to keep
seperate caches.

Signed-off-by: Robin Appelman <robin@icewind.nl>
4 years ago
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Robin Appelman 5439469b68
optimize getMetaData for local storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
4 years ago
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
Roeland Jago Douma 0568b01267
Improve etag handling
Check if values exist before using them

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Roeland Jago Douma 1cc8a2f5d2
Supress warnings touch can generate
We already catch the result value. Having the warning being logged
explicitly doesn't help and polutes the log.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Robin Appelman f39605dabc
verify that paths are valid for recursive local move
Signed-off-by: Robin Appelman <robin@icewind.nl>
5 years ago
Robin Appelman 93de63777e
extend storage api to allow directly writing a stream to storage
this removes the need for temporary storages with some external storage backends.
The new method is added to a separate interface to maintain compatibility with
storage backends implementing the storage interface directly (without inheriting common)

Currently the interface is implemented for objectstorage based storages and local storage
and used by webdav uploads

Signed-off-by: Robin Appelman <robin@icewind.nl>
6 years ago
Arthur Schiwon 38a90130ce
move log constants to ILogger
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
6 years ago
Morris Jobke bcba1a97ad
Use fallback path if data dir is not available for Storage/Local.php
Found while testing strict types for PHP7+.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Signed-off-by: Robin Appelman <robin@icewind.nl>
6 years ago
Morris Jobke 01040daf02
Fix call to clearstatcache to actually use the file path
* found while adding the strict_typing for PHP 7+ migration
* first argument is a boolean - second one is the path
* see http://php.net/manual/en/function.clearstatcache.php

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Joas Schilling 94f3fc63bc
Use ::class and fix missing doc
Signed-off-by: Joas Schilling <coding@schilljs.com>
7 years ago
Roeland Jago Douma ace7b69aa7
Fix copy from jailed storage
If we have a jailed storage we must also fix the internal path on copy.
Else we pass in the wrong path.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
7 years ago
Lukas Reschke dfd8125aeb
Replace wrong PHPDocs
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
7 years ago
Michael Munger b8f2418248 Fixed a crash caused by Local::copyFromStorage() not conforming to Common::copyFromStorage. Issue# 5071 7 years ago
Robin Appelman 8500debe79
use unjailed path when moving files out of a shared storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Lukas Reschke 49ba822fef
Remove verbose error message
There's no need to have this included in the error message.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
7 years ago
Jörn Friedrich Dreyer 6fd7d4efd0
remove obsolete hack (#26928)
* remove obsolete hack

> // file_get_contents() has a memory leak: https://bugs.php.net/bug.php?id=61961
was closed 4 years ago. we could also use the Common implementation

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke 27ba46c40e Merge pull request #1890 from nextcloud/downstream-25428
fixing php 32 bit (arm) filemtime on large file issue (#18971) (#25428)
8 years ago
Lukas Reschke 459477e2c3
Move function to LargeFileHelper
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
8 years ago
Boris Rybalkin cfc0d9249b
fixing php 32 bit (arm) filemtime on large file issue (#18971) (#25428)
* fixing php 32 bit (arm) filemtime on large file issue (#18971)

* cast to int
8 years ago
Lukas Reschke df3444493b
Remove not existent function call
- Removes a not existent function call
- Removes a fallback for Windows

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
8 years ago
Vincent Petry 1f21a132c7
Only use realpath for real directories (#26058)
In some cross-local-storage use cases, the Local storage is
instantiated with "/" as data directory. In such cases, calling
realpath() would cause PHP warnings when open_basedir is set.

This fix bypasses the realpath() call when dealing with a root storage.

Downstreaming of https://github.com/owncloud/core/pull/26058

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
8 years ago