Commit Graph

482 Commits

Author SHA1 Message Date
Robin Appelman 6c9f2644cf
Add objectExists to objectstore interface
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-12-12 14:17:19 +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
Robin Appelman f7ae235372
cache OC\Files\Mount\Manager::findIn results
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-16 19:02:00 +02:00
Robin Appelman f8116ad4cf
use more efficient method to find mountpoint for path
this changes the complexity from the number of mounts to the depth of
the path

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-16 18:55:52 +02:00
Robin Appelman 95981810c0
remove double loop for detecting changed mounts
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-16 18:24:56 +02:00
Robin Appelman 5e9d6b1585
use insertIfNotExists to store new mimetypes.
Also throw an error if we can't find the mimetype after insert

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-09 15:20:55 +02:00
Björn Schießle 11e99859ef
Merge pull request #10397 from nextcloud/encryption-s3-fix
make file cache updates more robust
2018-08-08 18:27:18 +02:00
Roeland Jago Douma 01bbd28530
Do not log to error loglevel when converting the error
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-08-06 16:31:30 +02:00
Bjoern Schiessle a9e22c5f1c
make file cache updates more robust
only update the encrypted version after the write operation is finished and the stream is closed

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-31 12:24:38 +02:00
Robin Appelman 5e940366c2
Do scan the root storage in background scan
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-07-24 14:15:27 +02:00
Morris Jobke 19c49c8473
Use the path_hash instead of the path to query the filecache
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-07-16 16:10:34 +02:00
Morris Jobke cc9073c251
Merge pull request #10179 from nextcloud/mount-filter
Add the option to filter mounts for a user
2018-07-11 16:29:09 +02:00
Julius Härtl 6da2b7c4f6
Separate fopen into read and write methods
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-07-11 12:08:37 +02:00
Julius Härtl f1469e34aa
Add fopen method to ISimpleFile
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-07-11 10:29:03 +02:00
Robin Appelman 3ad6084891
Add the option to filter mounts for a user
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-07-10 16:49:26 +02:00
Bjoern Schiessle 5d0fa12e12
allow to disable encryption
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2018-07-05 17:24:44 +02:00
Morris Jobke 48b7499fa4
Merge pull request #10079 from nextcloud/search-double-slash
fix double slash in search result path when the result is in a submount
2018-07-02 15:49:27 +02:00
Robin Appelman 922c851494
fix double slash in search result path when the result is in a submount
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-07-02 14:17:38 +02:00
Robin Appelman b9e685236f
Add option to only scan the home storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-28 16:09:25 +02:00
Julius Härtl 73cf71a20f
Add resource type phpDoc for putContent methods
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-06-26 13:58:58 +02:00
Robin Appelman 587d7cc7d2
Merge pull request #9526 from Blaok/files-scan-shallow
allow shallow (non-recursive) scan when scanning file storage
2018-06-25 13:01:22 +02:00
Roeland Jago Douma 54c4d95a11
Request a valid property for DAV opendir
Apperently Sabre and Onedrive are not friends when requesting a single
404 property. I need to dig deeper on why this is. Anyways requesting a
valid property makes it work like a charm.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-21 19:01:27 +02:00
Robin Appelman 47fd3499a3
Fix listing s3 objects when using google cloud aws compatibility
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-11 17:10:57 +02:00
Roeland Jago Douma 49145a78e9
Make sure initial files can be properly created
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-07 12:07:37 +02:00