Commit Graph

98 Commits (e7cc7653b885c49b1b3f0a78f91ea05a53e102d8)

Author SHA1 Message Date
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +07:00
Robin Appelman 5267a74027
fix type hints
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-04-04 17:05:45 +07:00
Robin Appelman 8c9197d65e
fix unencrypted folder size when no children with unencrypted size set are left
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-04-04 16:48:11 +07:00
Robin Appelman 63fb33538c
fix unencrypted_size for folders when scanning the filesystem with encryption enabled
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-04-04 16:48:10 +07:00
Robin Appelman c9e4e30523 clear encrypted flag when moving away from encrypted storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-04-01 15:36:37 +07:00
Côme Chilliet c60182065f
Merge pull request #34773 from nextcloud/artonge/feat/dispatch_entry_removed_event_for_all_entries
Dispatch event for all removed entries
2023-03-21 11:42:18 +07:00
Joas Schilling 4bdc5834fa
Make sure name and path are strings
Otherwise Oracle returns NULL for empty strings and PHP 8.2
throws on null in string functions like trim() and md5()

Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-02-02 12:05:22 +07:00
Joas Schilling c27c9fac98
Try fixing Oracle
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-02-02 12:05:21 +07:00
Louis Chemineau 2830eeac7e Dispatch event for all remove entry
Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-01-31 13:30:10 +07:00
Robin Appelman de63f6363f fix updating size when folder is empty
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 13:54:26 +07:00
Robin Appelman 1374cbee3e store unencrypted size in the unencrypted_size column
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 13:54:26 +07:00
Robin Appelman 5e375d9092 Revert "store unencrypted size in the unencrypted_size column"
This reverts commit 8238582e59.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 12:07:14 +07:00
Côme Chilliet cb271b759e
Fix dynamic property creations in test files
This fixes warnings in PHP 8.2

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-01 15:07:53 +07:00
luz paz 368f83095d Fix typos in lib/private subdirectory
Found via `codespell -q 3 -S l10n -L jus ./lib/private`

Signed-off-by: luz paz <luzpaz@github.com>
2022-07-27 08:52:17 +07:00
Jonas 7d07e06bfe Check whether entry is of type ICacheEntry in Cache->remove()
In some scenarios (file not in cache, but partial data of it in the
object), Cache->get() might return an array, which leads to errors like
"Call to a member function getId() on array".

So check whether the returned entry is of type ICacheEntry before doing
operations on it in Cache->remove().

Fixes: #33023

Signed-off-by: Jonas <jonas@freesources.org>
2022-06-29 10:47:07 +07:00
Robin Appelman 8238582e59
store unencrypted size in the unencrypted_size column
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-06-02 16:07:00 +07:00
Côme Chilliet ea23523c70
Adapt more code to migration to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 16:21:25 +07:00
acsfer 074a9a5e88
Switch logical operators
Unless there is a good reason to keep actual ones 👀
2021-12-03 16:05:19 +07:00
John Molakvoæ 63d3931e80
Merge pull request #29281 from vijfhoek/master 2021-11-01 11:29:37 +07:00
Carl Schwan bfa60aaf27
Fix permissions when copying from ObjectStorage
Make sure that when a user copy a file from a directory they don't have
all permissions to a directory where they have more permissions, the
permissions are correctly set to the one from the parent taget folder.

This was caused by the ObjectStoreStorage::copyFromStorage using
the jailed storage and cache entry instead of the unjailed one like other
storages (the local one).
Steps to reproduce

+ Use object storage
+ Create a groupfolder with one group having full permission and another one
  who can just read files.
+ With an user who is in the second group, copy a file from the groupfolder to
  the home folder of this user.
+ The file in the home folder of the user will be read only and can't be deleted
  even though it is in their home folder and they are the owner. In oc_filecache,
  the permissions stored for this file are 1 (READ)

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-10-28 13:29:50 +07:00
Sijmen Schoon 34600c78bb
Move query outside the loop and reduce chunk size to 1000
This involved changing CacheQueryBuilder\whereParentIn to take a
parameter name, renaming the function accordingly.

Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
2021-10-17 20:57:28 +07:00
Sijmen Schoon c959bf2b42
Limit parameter count per query in Cache.removeChildren
Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
2021-10-17 19:10:58 +07:00
Carl Schwan 28970563a2
Remove some mentions of ownCloud from our api documentation
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-07-29 15:56:30 +07:00
Robin Appelman 362cb2a11f
inject SearchBuilder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:23:08 +07:00
Robin Appelman 5d1d53c42e
perform file search in a single query
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:29 +07:00
Robin Appelman 9774fb1573
use searchoperation for storage filter instead of db expression
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:25 +07:00
Robin Appelman e198dc1b20
rework search api to allow searching on multiple caches at once
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:22 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
John Molakvoæ (skjnldsv) 2074d87d0c
Catch invalid cache source storage path
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-03-24 10:36:51 +07:00
Robin Appelman 50e374c12f
only require user to be set in a query that handles tags
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-18 17:16:28 +07:00
Robin Appelman f1e2fb426e
Merge pull request #26013 from nextcloud/object-store-copy-cache-id
Return the fileid from `copyFromCache` and use it instead of doing an extra query
2021-03-16 16:11:17 +07:00
Robin Appelman d7748e2b4d
verify that cache entry is valid
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-12 17:23:02 +07:00
Robin Appelman d2bcb57a54
add ICopyFromCache trait to expose existing implementation
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-12 17:22:36 +07:00
Robin Appelman a44aab11f7
do cachejail search filtering in sql
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-01-26 15:30:46 +07:00
Christoph Wurst 8b64e92b92
Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-01-08 11:45:19 +07:00
Christoph Wurst 9ce3ea3368
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-30 14:07:05 +07:00
Roeland Jago Douma 4973f9b952
Merge pull request #24715 from nextcloud/bug/noid/limit-get-incomplete-to-1
Limit getIncomplete query to one row
2020-12-21 09:15:10 +07:00
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +07:00
Daniel Kesselberg e0e76bb784
Limit getIncomplete query to one row
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-12-15 21:42:26 +07:00
Robin Appelman aef1cdba03
code style and dispatchTyped
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-12-02 16:15:02 +07:00
Robin Appelman 88f35d52d2
rename cache event to follow new naming standards
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-11-26 15:39:46 +07:00
Robin Appelman 23fb497ff5
extend cache events
- adds cache remove event
- expose storage id in event
- emit events during cache move

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-11-26 15:22:03 +07:00
Joas Schilling cffad62771
Empty string is returned as null, but empty string in file cache is the root and exists
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-10 15:35:43 +07:00
Joas Schilling 8027dcbc6f
Don't leave cursors open when tests fail
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-09 12:28:17 +07:00
Morris Jobke 99c9423766
Remove @suppress SqlInjectionChecker
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-16 15:53:56 +07:00
Robin Appelman 5af7d921a9
Make Cache::removeChildren non recursive
Currently the "add new files during scanning" call stack is smaller than
the "remove deleted files during scanning" call stack. This can lead to
the scanner adding folders in the folder tree that are to deep to be
removed.

This changes the `removeChildren` logic to be non recursive so there is
no limit to the depth of the folder tree during removal

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-08-20 15:37:02 +07:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +07:00
Christoph Wurst 1584c9ae9c
Add visibility to all methods and position of static keyword
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:51:06 +07:00
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>
2020-04-10 14:19:56 +07:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +07:00