Arthur Schiwon
43bc31bacb
set a storage availability delay on auth issues to avoid lock out
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
4 years ago
Roeland Jago Douma
650927a822
Properly return an int in the getId function of the cache
fixes #16684
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
4 years ago
Roeland Jago Douma
0487144b26
Remove deprecated searchByTag
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
4 years ago
Robin Appelman
6a30c65a32
remove extra param in cache update call
param was leftover from earlier iterations of the "update event"
Signed-off-by: Robin Appelman <robin@icewind.nl>
5 years ago
Ari Selseng
d16cfb519e
Avoid calculating folder size for parent that needs scan.
Signed-off-by: Ari Selseng <ari@selseng.net>
5 years ago
Robin Appelman
092f78d7a4
add event for cache update
Signed-off-by: Robin Appelman <robin@icewind.nl>
5 years ago
Robin Appelman
748bcd407b
add event for inserting cache entries
this provides a reliable way for apps to listen to new files
without the need to of cache wrappers to hook into inserts themselves
(something which isn't 100% reliable)
Signed-off-by: Robin Appelman <robin@icewind.nl>
5 years ago
Roeland Jago Douma
72f3882d4b
No need to propogate changes in appdata
Right now we propogate a lof of changes in appdata. So for example we
propogate each and every preview that is added to the system. This has
no real added value as far as I can tell.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Roeland Jago Douma
f7a1ed8656
Only execute query in propagateChange once
The second execute statement should be inside the if block. Else it gets
executed twice which makes no sense.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Robin Appelman
5d5cfefd35
return the correct value when trying to get a non existing item from cache by id
Signed-off-by: Robin Appelman <robin@icewind.nl>
5 years ago
Morris Jobke
93c62d78db
Fix UniqueConstraintViolationException while insert into oc_filecache
* fixes #6160 by not being prone to the race condition in insertIfNotExists
* fixes #12228 by not using a query that can result in a deadlock
* replaces the insertIfNotExists call with an insert which is wrapped into a try-catch block
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
5 years ago
Joas Schilling
bb352fb667
Use the defined func()->count() instead of manual counting
Signed-off-by: Joas Schilling <coding@schilljs.com>
5 years ago
Roeland Jago Douma
0277cd7158
Properly search the root of a shared external storage
Fixes #1020
When an external storage is shared with you in full the root is ''
(empty). This adds an extra check for an empty jail basically.
Because if the jail is on the empty string. It matches all paths.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Robin Appelman
6c5ea0ceca
pass `Cache::getMoveInfo` along cache wrappers
fixes cross storage move in some cases
Signed-off-by: Robin Appelman <robin@icewind.nl>
5 years ago
Robin Appelman
63caf331e5
cleanup locks in scanner on error
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
Roeland Jago Douma
c1ff12e234
CacheJail should apply limit and offset after searching
Else the results might not be correct.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
6 years ago
Roeland Jago Douma
53a780e31c
Do not try to get the jailed path if we can't find the id
Fixes #8047
If we can't find the file by id there we should just return null instead
of trying to get the jailed path of null.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
6 years ago
Morris Jobke
eb51f06a3b
Use ::class statement instead of string
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Morris Jobke
a661f043e1
Remove unneeded semicolon and parentheses
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Morris Jobke
16a558871c
Use proper code flow instead of not needed else branch
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Morris Jobke
4dbee99b7b
Remove useless return statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Morris Jobke
2a38605545
Properly log the full exception instead of only the message
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Robin Appelman
326d55db81
Support arbitrary number of arguments for d:or and d:and in search queries
Signed-off-by: Robin Appelman <robin@icewind.nl>
6 years ago
Roeland Jago Douma
8a41d05761
Remove deprecated \OCP\Config
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
6 years ago
Robin Appelman
c87d689253
delay calculating the shared cache root until it's used
Signed-off-by: Robin Appelman <robin@icewind.nl>
6 years ago
Morris Jobke
be4e921306
Use basename() instead of self implementation
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>
6 years ago
Robin Appelman
804d97d6ff
unlock file when an exception occurs during scanning
Signed-off-by: Robin Appelman <robin@icewind.nl>
6 years ago
Morris Jobke
c27498db71
Use IConfig instead of static OCP\Config
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Robin Appelman
06a4d6b5b9
Also repair storage id's when repairing invalid entries
Signed-off-by: Robin Appelman <robin@icewind.nl>
6 years ago
Lukas Reschke
3d2600b039
Add Phan plugin to check for SQL injections
This adds a phan plugin which checks for SQL injections on code using our QueryBuilder, while it isn't perfect it should already catch most potential issues.
As always, static analysis will sometimes have false positives and this is also here the case. So in some cases the analyzer just doesn't know if something is potential user input or not, thus I had to add some `@suppress SqlInjectionChecker` in front of those potential injections.
The Phan plugin hasn't the most awesome code but it works and I also added a file with test cases.
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
6 years ago
Artem Kochnev
5abeb9519e
Fix for mb strlen
Error with moving files with long names in UTF-8
6 years ago
Robin Appelman
dfe662ad42
Fix propagating changes within jail wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
fa81759917
fix moving folders out of a cache jail
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
1f1e1b0d00
use unmasked permissions during scanning
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Morris Jobke
c54a59d51e
Remove unused use statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Robin Appelman
bb7e236e74
Allow searching file by fileid
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
d4a7cfec7c
rename fun to func
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
fee818f493
Add tests for query builder (i)like
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
4b7bc2af0e
Move all children of a folder in a single query
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
2d02a4735c
Fix search ordering
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Vincent Petry
89c42a76c3
Remove SharedCache::getNumericStorageId to let CacheWrapper do it
The CacheWrapper will properly forward the call to the wrapped cache.
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Xuanwo
210f4106c4
[OC/Files/Cache]: Fix wrong usage of basename
Fix https://github.com/nextcloud/server/issues/3837
Signed-off-by: Xuanwo <xuanwo@yunify.com>
7 years ago
Robin Appelman
6d0c756ff9
dont allow empty wildcard search
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
e61606a767
Allow searching for favorites
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
df2063ee7b
Implement webdav SEARCH
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Robin Appelman
706131b394
add icewind/searchdav
Signed-off-by: Robin Appelman <robin@icewind.nl>
7 years ago
Frédéric Fortier
55a37c1db9
Refactor files' CacheEntry object creation to call cacheEntryFromData() all the time thus allowing proper casts to be done
Signed-off-by: Frédéric Fortier <frederic.fortier@oronospolytechnique.com>
7 years ago
Frédéric Fortier
cc511ac7b8
Typecast filecache 'storage' as int to return it as documented, fixes #3461
Signed-off-by: Frédéric Fortier <frederic.fortier@oronospolytechnique.com>
7 years ago