Use a lazy user for the file owner when listing a directory
Only getUID and getDisplayName are called on the file owner objects anyway
and we can get this information often without DB request
Signed-off-by: Robin Appelman <robin@icewind.nl>
($something->getPermissions() && Constants::PERMISSION_READ) does not
make sense as PERMISSION_READ contant is 1 this will always evaluate to
true.
getPersmissions is returning an int which is a bitwise combination as
documented in the interface, so it should be used with bit operators.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Check whether output buffering is active before turning it off
Before we just turned it off and @suppressed the error if ob was not active.
In PHP 8 this error is no longer suppressed, so try to not cause it at all.
Signed-off-by: Richard de Boer <git@tubul.net>
In certain cases changeLock to EXCLUSIVE fails
and throws LockedException. This leaves the
file locked as SHARED in file_put_contents,
which prevents retrying (because on second
call file_put_contents takes another SHARED
lock on the same file, and changeLock doesn't
allow more than a single SHARED lock to promote
to EXCLUSIVE).
To avoid this case, we catch the LockedException
and unlock before re-throwing.
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
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>
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
handle storage exceptions when trying to set mtime
not all storage backends can handle setting the mtime and they might
not always handle that error correctly.
Signed-off-by: Robin Appelman <robin@icewind.nl>