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
Côme Chilliet
f5c361cf44
composer run cs:fix
...
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +07:00
Git'Fellow
e855298b3c
Switch logical operators
...
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-01-11 16:27:33 +07:00
Vincent Petry
3b7cc31f64
Merge pull request #34924 from nextcloud/cache-jail-path-prefix
...
escape path prefix when doing cache jail search
2022-12-16 17:27:15 +07:00
Andy Xheli
e69c7c4d26
Fix Executing a query: SQLSTATE[42000]
...
Signed-off-by: Andy Xheli <axheli@axtsolutions.com>
Fix https://github.com/nextcloud/server/issues/32007#issuecomment-1329405245
Signed-off-by: Andy Xheli <axheli@axtsolutions.com>
2022-11-29 11:24:56 +07:00
Robin Appelman
f76b4473ee
escape path prefix when doing cache jail search
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-11-02 12:44:51 +07:00
Vincent Petry
4aa8e80511
Merge pull request #34579 from nextcloud/unencrypted-size-null
...
fix null error in getUnencryptedSize
2022-10-21 16:53:43 +07:00
Carl Schwan
54031e370a
Fix various other small psalm issues
...
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-17 12:40:35 +07:00
Robin Appelman
63316fc572
fix null error in getUnencryptedSize
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-10-13 15:34:48 +07:00
raul
95bc770a37
Fix unencrypted size calculation for files created before the Encryption storage is enabled
...
Signed-off-by: raul <raul@nextcloud.com>
2022-10-03 13:44:14 +07:00
raul
45a1ebcc4c
Fix: Prevent deadlocks during mtime/size/etag propagation
...
Signed-off-by: raul <raul@nextcloud.com>
2022-10-03 13:44:14 +07:00
Robin Appelman
b6f8b8da60
directly build the search filter for shared storage instead of setting up the source cache
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-17 11:58:57 +07:00
Vincent Petry
312b719acf
Merge pull request #32943 from nextcloud/unencrypted-size-revert-interface-changes
...
Revert interface changes from "store unencrypted size in the unencrypted_size column"
2022-08-17 11:36:16 +07:00
Vincent Petry
11d5a1d3df
Merge pull request #33550 from nextcloud/jail-search-post
...
optimize search post-processing for jail wrapper
2022-08-17 10:55:41 +07:00
Vincent Petry
082432e01c
Merge pull request #33551 from nextcloud/scanner-dont-update-same-size
...
don't update the folder size if we know it hasn't changed
2022-08-17 09:21:30 +07:00
Robin Appelman
457822c144
don't update the folder size if we know it hasn't changed
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 13:56:51 +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
9d6c2ce301
optimize search post-processing for jail wrapper
...
don't both asking the wrapped cache if we know it's not in our jail anyway
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 13:36:52 +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
David
fe3f4afd77
fixed the cache searchBuilder negative map
...
Signed-off-by: David <37280718+yeyulantu@users.noreply.github.com>
2022-08-16 17:59:02 +07:00
Côme Chilliet
7ae6791737
Document all getIncomplete implementations as returning string|false
...
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-02 14:23: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
Carl Schwan
f326b54e53
Search without join on filecache_extended
...
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-06-23 16:23:52 +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
Marcel Klehr
f755ee0868
Files: Extend search to also cover tags
...
fixes #326
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2022-05-17 21:05:09 +07:00
Côme Chilliet
069477e608
Migrate more classes of lib/private to LoggerInterface
...
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-26 16:52:52 +07:00
Robin Appelman
a4e120c203
tell mysql to ignore the sort index for search queries
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-22 13:42:33 +07:00
Robin Appelman
9834350ac3
Merge pull request #31713 from nextcloud/fed-performance
...
Federated share performance improvements
2022-04-07 18:53:36 +07:00
Joas Schilling
a44671d396
Merge pull request #31816 from nextcloud/bugfix/noid/deduplicate-storage-id-before-reusing
...
Deduplicate storage ids in list before reusing
2022-04-04 19:00:22 +07:00
Robin Appelman
cc5e26bb14
Merge pull request #31776 from nextcloud/storage-id-cache-bi-directional
...
cache storage id mapping both ways
2022-04-04 14:50:23 +07:00
Robin Appelman
5e2dd29aaf
only request free space once for external shares
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-04 16:48:27 +07:00
Robin Appelman
89d3cd1447
don't overwrite the etag from storage backends that already provide "good" etags
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-04 16:48:18 +07:00
Joas Schilling
d3b9d49c22
Deduplicate storage ids in list before reusing
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-04-04 07:07:48 +07:00
Robin Appelman
ac657b0f06
cache storage id mapping both ways
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-31 14:35:42 +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
Côme Chilliet
6be7aa112f
Migrate from ILogger to LoggerInterface in lib/private
...
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 16:21:25 +07:00
Robin Appelman
84f464550a
some file scanner performance improvements
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-17 22:21:16 +07:00
Robin Appelman
b0ce876f41
return dummy availability if storage is not found in cache
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-02-25 15:25:13 +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
Robin Appelman
f5fe887b4b
background scan the source storage when a background scan on a storage jail is triggered
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-12-02 17:34:58 +07:00
Côme Chilliet
113756db30
Fix ArrayAccess and JsonSerializable return types
...
First round of modifications for PHP 8.1
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:28:56 +07:00
Vincent Petry
c92a0e4152
Normalize directory entries in Encoding wrapper
...
Directory entry file names are now normalized in getMetaData(),
getDirectoryContents() and opendir().
This makes the scanner work properly as it assumes pre-normalized names.
In case the names were not normalized, the scanner will now skip the
entries and display a warning when applicable.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-17 09:43:25 +07:00
Vincent Petry
67ebe75d0e
Move storage encoding compatibility warning logic
...
The encoding check for file names is now happening the Scanner, and an
event will be emitted only if the storage doesn't contain the encoding
compatibility wrapper.
The event is listened to by the occ scan command to be able to display a
warning in case of file name mismatches when they have NFD encoding.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-17 09:24:13 +07:00
Vincent Petry
39fe43b914
Normalize file name before existence check in scanner
...
The scanner would not find a NFD-encoded file name in an
existing file list that is normalized.
This normalizes the file name before scanning.
Fixes issues where scanning repeatedly would make NFD files flicker in
and out of existence in the file cache.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-17 09:24:13 +07:00
Robin Appelman
118c647f61
properly handle cases where cache wrappers block access
...
`CacheWrapper::formatCacheEntry` can return false for files that should be filtered out
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-11-01 11:48:01 +07:00
John Molakvoæ
63d3931e80
Merge pull request #29281 from vijfhoek/master
2021-11-01 11:29:37 +07:00
Carl Schwan
df4e6bab69
Merge pull request #29115 from nextcloud/work/carl/correct-permissions-when-copying
...
Fix permissions when copying from ObjectStorage
2021-10-28 14:38:20 +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
Robin Appelman
55346b5d6c
more reliable return value for Watcher::checkUpdate
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-15 16:03:18 +07:00
Robin Appelman
7351059326
generate a better optimized query for path prefix search filters
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-26 19:07:52 +07:00
Vincent Petry
e32d293346
Merge pull request #28476 from nextcloud/search-jail-insensitive
...
use case insensitive like when limiting search to jail
2021-08-24 08:59:35 +07:00
Robin Appelman
c688703117
use getGetUnjailedRoot to determine if jailed search needs the path filter
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-23 16:27:53 +07:00
Robin Appelman
c48f9ffcdd
use case insensitive like when limiting search to jail
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-17 13:51:45 +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
97aadbe46c
dont apply jail search filter is on the root
...
the extra '/' breaks things and the filter wouldn't do anything anyway except making the databases job harder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-07-26 17:44:52 +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
66e10718c6
split of query building bits from searchhelper
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:40 +07:00
Robin Appelman
f938daa6e4
update tests and fix some edge cases around new search
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:36 +07:00
Robin Appelman
27e50b24aa
some cleanup and documentation
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:32 +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
Robin Appelman
7ee528fc5a
properly use limit and offset for search in Jail wrapper
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-05-21 15:37:38 +07:00
Robin Appelman
ed2396b045
better cleanup of filecache when deleting an external storage
...
this way it can delete the cache entries even with per-user credentials
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-05-19 17:08:20 +07:00
Morris Jobke
81fef4ddee
Log when a storage is marked as unavailable
...
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-03-25 16:19:08 +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
Vincent Petry
e559afb8d4
Merge pull request #25136 from nextcloud/cachejail-search-filter
...
do cachejail search filtering in sql
2021-03-15 17:45:30 +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
c2fc3195dd
also implement for FailedCache and NullCache
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-12 17:22:43 +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
Roeland Jago Douma
e6ef096e52
Merge pull request #25659 from nextcloud/smb-getmetadata-catch
...
catch notfound and forbidden exception in smb::getmetadata
2021-03-05 08:49:23 +07:00
Robin Appelman
b844293536
catch notfound and forbidden exception in smb::getmetadata
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-04 21:34:54 +07:00
Roeland Jago Douma
c3f1eb4f7f
Remove Redundantcasts
...
For #25839
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-04 14:44:04 +07:00
dependabot-preview[bot]
eb502c02ff
Bump nextcloud/coding-standard from 0.3.0 to 0.5.0
...
Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard ) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/nextcloud/coding-standard/releases )
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md )
- [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-02-18 13:31:24 +07:00
Robin Appelman
0363af3790
move AbstractCacheEvent into OCP
...
otherwise we have concrete cache events in OCP extending non OCP classes
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-02-15 19:12:30 +07:00
Robin Appelman
e511a539b7
adjust tests
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-01-26 15:55:38 +07:00
Robin Appelman
5ae0be08b4
fix search in nested jails
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-01-26 15:30:54 +07:00
Robin Appelman
27f9df2e87
fix cachjail searching for root
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-01-26 15:30:50 +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
Robin Appelman
205386b24e
ignore files that have no read permissions during scanning
...
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-01-06 17:27:31 +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