Commit Graph

504 Commits

Author SHA1 Message Date
Morris Jobke 50d7f87eab
Merge pull request #14269 from nextcloud/cache-update-event
add event for cache update
2019-02-19 11:07:59 +01:00
Robin Appelman 092f78d7a4
add event for cache update
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-02-18 16:50:41 +01:00
Roeland Jago Douma f6f002e2ad
Merge pull request #14210 from nextcloud/fix/14192/fix_empty_uploads
Fix empty file uploads to S3 (and other streaming storages)
2019-02-18 15:39:17 +01:00
Roeland Jago Douma 104616c1da
Use CountWrapper instead of almost identical CountReadStream
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-02-15 13:24:58 +01:00
Roeland Jago Douma 61d66d7954
Fix empty file uploads to S3
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-02-15 08:41:39 +01:00
Roeland Jago Douma 62ddb124a1
Filter out versions and trashbin
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-02-13 21:27:25 +01:00
Roeland Jago Douma cb67c6aa00
Loop for the recent search
Else it might happen that less entries than requested are returned

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-02-13 21:22:16 +01:00
Roeland Jago Douma 4c7424d38b
We need to initialize the storage else the jailed path is always null
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-02-13 21:01:17 +01:00
Morris Jobke baa6a2d52c
Merge pull request #13748 from nextcloud/cache-insert-event
add event for inserting cache entries
2019-02-07 16:35:02 +01:00
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>
2019-02-07 15:51:30 +01:00
William Pain c26bdd4731 Fix: Check if `$this->params['user']` is an array
Signed-off-by: William Pain <pain.william@gmail.com>
2019-02-05 09:56:42 +01:00
Robin Appelman 1d322d3b37
always use multipart uploader for s3 uploads
the multipart uploader handles non seekable streams while `upload` does not

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-01-28 14:51:19 +01:00
Morris Jobke 90e985fe4f
Merge pull request #13739 from nextcloud/cache-cleanup-change
cleanup shared lock if changing to exclusive lock failed
2019-01-22 16:11:46 +01:00
Robin Appelman f69c2d1e84
cleanup shared lock if changing to exclusive lock failed
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-01-22 15:32:48 +01:00
Morris Jobke c3b22f05bb
Merge pull request #13468 from rummatee/issue13276
don't close input stream when writing in encrypted file
2019-01-14 16:21:08 +01:00
Morris Jobke 5a27e54f4b
Merge pull request #13032 from nextcloud/objectstore-write-exists
upload new files in objectstore to a .part path first
2019-01-14 11:26:29 +01:00
Robin Appelman 615fb8cd77
Cache tokens when using swift's v2 authentication
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-01-13 19:59:48 +01:00
Florian Schunk c2f8df0573 don't close input stream when writing in encrypted file
Signed-off-by: Florian Schunk <florian.schunk@rwth-aachen.de>
2019-01-10 00:25:07 +01:00
Roeland Jago Douma d0956c9a42
Followup 12833, gracefully handle the getting of /
Else this breaks the app page

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-12-21 11:08:19 +01:00
Joas Schilling 6788e6e75c
Merge pull request #12883 from nextcloud/appdata-performance
try to grab the appdata folder directly without going trough the whole tree
2018-12-17 15:11:28 +01:00
Robin Appelman d6bf5d4384
upload new files in objectstore to a .part path first
This prevent the object store and cache from getting out of sync
when an objectstore silently fails or the php process get's killed
during the upload without giving us the chance to cleanup

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-12-12 15:24:40 +01:00
Robin Appelman 6c9f2644cf
Add objectExists to objectstore interface
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-12-12 14:17:19 +01:00
Robin Appelman 740ea0d30e
try to grab the appdata folder directly without going trough the whole tree
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-12-06 15:10:08 +01:00
Morris Jobke 60681decdd
Merge pull request #12865 from nextcloud/fix/do_not_propogate_in_appdata
No need to propogate changes in appdata
2018-12-06 08:50:22 +01:00
Morris Jobke ecc8068e66
Merge pull request #12857 from nextcloud/fix/emit_write_update_once_on_touch
Emit write update only once on touch
2018-12-05 22:54:47 +01:00
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>
2018-12-05 22:06:19 +01:00
Roeland Jago Douma 2c6d36105c
Emit write update only once on touch
When a touch is done (i.e. when creating a new file in the node API)
The hooks contain 'write' and 'touch' (and the operation is touch as
well). This would cause a double write update. Which doesn't make sense.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-12-05 21:29:48 +01:00
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>
2018-12-05 20:32:02 +01:00
Robin Appelman 9d9f6903c9
Fix folder path containing leading slash when getting mount root by id
This fixes collabora on public link shared groupfolders

Fixes https://github.com/nextcloud/groupfolders/issues/225

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-11-28 15:18:29 +01:00
Morris Jobke cc6c30e769
Merge pull request #12494 from nextcloud/cache-notfound-id
return the correct value when trying to get a non existing item from cache by id
2018-11-20 09:51:18 +01:00
Morris Jobke cef8eadf2a
Add PHPDoc for thrown exception
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-11-19 15:34:07 +01:00
Robin Appelman 35251928d5
forward object not found error in switch as dav 404
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-11-19 11:34:38 +01:00
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>
2018-11-16 17:26:42 +01:00
Christoph Wurst 1b85ef4bf2
Fix string doc type casing
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2018-11-15 11:57:05 +01:00
Morris Jobke fd8eeccb15
Merge pull request #11942 from nextcloud/techdebt/noid/use-count-function
Use the defined func()->count() instead of manual counting
2018-11-12 17:43:56 +01:00
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>
2018-11-12 14:43:28 +01:00
Joas Schilling bb352fb667
Use the defined func()->count() instead of manual counting
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-11-08 15:44:45 +01:00
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>
2018-11-05 16:27:43 +01:00
Robin Appelman 9b3cc72f7c
fix writeStream for jail wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-10-31 21:10:57 +01:00
Robin Appelman c6a48110bf
allways fall back to fopen for encryption wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-10-31 21:10:51 +01:00
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>
2018-10-31 21:10:44 +01:00
Robin Appelman e5c3e4b76f
Add getExtension() to FileInfo
this is a fairly common operation so it makes sense to prevent having
to repeatedly implement it.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-10-29 15:24:02 +01:00
Roeland Jago Douma 0fb070b5b4
Allow chunked uploads even if your quota is not sufficient
Fixes #11485

This allows uploads to shared folders.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-10-24 20:29:00 +02:00
Robin Appelman 6c5ea0ceca
pass `Cache::getMoveInfo` along cache wrappers
fixes cross storage move in some cases

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-10-17 14:57:33 +02:00
Robin Appelman 565d830c11
expose storagefactory in server container
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-10-17 14:57:30 +02:00
Robin Appelman ea42474b31
use name in fileinfo if set
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-10-17 14:56:51 +02:00
Roeland Jago Douma 51e96dc3f6
Normalize getUnjailedPath
Fixes #11637

If we do not normalize the unjailed path we might end up with a path
like files/user/folder/. which can break on objectstores

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-10-11 14:43:48 +02:00
Roeland Jago Douma d5bf2c4523
Move normalizePath to regexes instead of looping
This is IMO a bit more readable and it seems to make the code faster.
Tested it on the company instance where there are over 3k calls to this
function. It shaves off around 10ms.

The advantage here is that the pattern gets optimized by php itsel and
cached.
Also looking for all patterns at the same time and especially no longer
looping for /./ patterns should save time.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-10-10 13:23:59 +02:00
Robin Appelman 4c0cbdff36
tokens can't be valid local user names
this saves searching for shares on non-public link dav requests

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-16 21:27:57 +02:00
Robin Appelman c300516e51
more efficient way to detect added and removed mounts
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-16 19:56:49 +02:00