Commit Graph

682 Commits

Author SHA1 Message Date
Christoph Wurst 463b388589
Merge pull request #20170 from nextcloud/techdebt/remove-unused-imports
Remove unused imports
2020-03-27 17:14:08 +01:00
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +01:00
Christoph Wurst 74936c49ea
Remove unused imports
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 22:08:08 +01:00
Christoph Wurst 23eb0462e5
Use lowercase true, false and null constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 21:53:04 +01:00
Roeland Jago Douma b300dc5a50
Merge pull request #19782 from nextcloud/quota-wrapper-include-external
Use global used space in quota wrappen when external storage is included
2020-03-24 21:36:01 +01:00
Roeland Jago Douma 3443a00621
Actually check if the owner is not null
Else this can error out on storages that do not have an owner (e.g.
groupfolders).

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-03-16 13:12:10 +01:00
Roeland Jago Douma 9a35e789b4
Get correct mimetype on objectstores
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-03-11 11:14:12 +01:00
Roeland Jago Douma b6245be302
Merge pull request #19746 from nextcloud/locked-exception-forward-existing
pass the existing locks info when making locked exception with absolu…
2020-03-09 19:31:45 +01:00
Robin Appelman c32750ddd9
Use global used space in quota wrappen when external storage is included
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-03-04 18:02:50 +01:00
Robin Appelman fab22ac14c
pass the existing locks info when making locked exception with absolute paths
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-03-02 19:29:44 +01:00
Robin Appelman f972990469
dont try to update storage mtime if we can't get the mtime
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-03-02 15:57:25 +01:00
Robin Appelman 63608ef461
allow writing content directly when creating new SimpleFile
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-02-28 12:55:22 +01:00
Robin Appelman 5ca1929e8c
Create SimpleFile only when writing the content
instead of first creating an empty file and then writing the content.

This solves the overhead of creating an empty file with the common pattern:

```php
$file = $simpleFilder->newFile('foo.txt');
$file->putContent('bar.txt');
```

roughly halving the number of storage and database operations that need to be done when creating a `SimpleFile`.

This is not automatically done with `File` because that has a more complex api which I'm more hesitant to touch.
Instead the `Folder::newFile` api has been extended to accept the content for the new file.

In my local testing, the overhead of first creating an empty file took about 20% of the time for preview generation

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-02-28 12:55:22 +01:00
Joas Schilling dc050fb5e5
Allow to overwrite the path on the cache event
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-02-13 08:38:33 +01:00
Joas Schilling 08cadf8416
Don't create invalid users
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-02-12 10:55:27 +01:00
Christoph Wurst 1b46621cd3
Update license headers for 18
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-20 09:23:25 +01:00
Christoph Wurst b81b824da1
Add typed events for the filesystem/scanner
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-13 09:41:05 +01:00
Roeland Jago Douma c6e51924c8
Merge pull request #18236 from nextcloud/bugfix/noid/always-detect-mimetype-by-content-in-workflows
Allow to detect mimetype by content
2019-12-12 11:19:55 +01:00
Roeland Jago Douma 4356c91ffd
Fix detection of non extention types
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-12-12 09:58:22 +01:00
Roeland Jago Douma 4fad9e4e6b
Merge pull request #18314 from nextcloud/fixFileIdSearch
Fix ambigious fileID on search
2019-12-10 11:28:40 +01:00
Joas Schilling 107ef72afb
Try more methods
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-12-10 10:56:47 +01:00
tobiasKaminsky 41cb214112
fix https://github.com/nextcloud/server/issues/18313
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
2019-12-10 09:47:30 +01:00
Joas Schilling da44c2a414
Some more fixes in detecting the mimetype from the content
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-12-10 09:11:42 +01:00
Joas Schilling 1336dedd5d
Cleanup the code
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-12-10 09:11:40 +01:00
Joas Schilling b92ebb928a
Allow to check for the mimetype by content only
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-12-10 09:10:32 +01:00
Roeland Jago Douma 5dba8d318d
Fix search limit to home
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-12-09 20:38:13 +01:00
Daniel Kesselberg 29575c4d36
Move custom definition logic into method
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-12-09 12:10:19 +01:00
Daniel Kesselberg 64aba49461
Ensure that we don't merge broken json.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-12-09 12:09:43 +01:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Roeland Jago Douma 63cb31542d
Merge pull request #17941 from nextcloud/search-by-owner
Allow filtering the search results to the users home storage
2019-12-05 11:04:33 +01:00
Roeland Jago Douma 81b919ed9f
Merge pull request #18163 from nextcloud/fix_file_size
fix filename size
2019-12-04 14:15:07 +01:00
Roeland Jago Douma 76b78edd40
Merge pull request #17833 from nextcloud/propagator-no-negative-sizes
dont set folder size to negative values during propagation
2019-12-04 11:49:26 +01:00
Greta Doci 1110a93fc4 fix filename size, add comment
Signed-off-by: Greta Doci <gretadoci@gmail.com>
2019-12-04 11:04:46 +01:00
Robin Appelman f9e5b33c2b
remove old 'owner' filter
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-12-03 15:20:54 +01:00
Robin Appelman c62637da8b
Allow filtering the search results to the users home storage
This is done by adding a

```xml
<d:eq>
    <d:prop>
        <oc:owner-id/>
    </d:prop>
    <d:literal>$userId</d:literal>
</d:eq>
```

clause to the search query.

Searching by `owner-id` can only be done with the current user id
and the comparison can not be inside a `<d:not>` or `<d:or>` statement

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-12-03 13:49:37 +01:00
Roeland Jago Douma 6a940d5c74
Merge pull request #18149 from nextcloud/fix/18148/dont-create-bundle-too-early
delay creation of the cert bundle
2019-11-29 09:07:33 +01:00
Arthur Schiwon 0e911d643f
delay creation of the cert bundle
fixes #18148

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-11-28 17:00:55 +01:00
Julius Härtl 9eb1554fad
Properly anotate LockedException in files node api
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-11-28 14:17:15 +01:00
Roeland Jago Douma 0568b01267
Improve etag handling
Check if values exist before using them

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-27 13:34:42 +01:00
Arthur Schiwon fc16b09a2c
Files first to use own GenericEvent
* those are added to 18 only anyway :)

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-11-26 14:48:59 +01:00
Robin Appelman 74c6beb603
dont set folder size to negative values during propagation
normally this shouldn't be a problem, but cache/storage desync might cause this
so this adds some failsafe to ensure we dont corrupt the cache further

the minimum value is set to -1 instead of 0 in order to triger a background scan
on the folder and figure out the size properly

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-26 12:05:30 +01:00
Roeland Jago Douma c7d5b8fc49
Merge pull request #18079 from nextcloud/fixes/phpcs
Some php-cs fixes
2019-11-25 14:07:00 +01:00
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Roeland Jago Douma 9a64759af5
Harden watcher
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 13:38:16 +01:00
Roeland Jago Douma d625d8bd1e
Merge pull request #17824 from nextcloud/fix/dav/catch_forbidden
Catch forbidden http status code
2019-11-20 12:32:00 +01:00
Roeland Jago Douma 8800a7e890
Fix cache moves
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-18 12:48:00 +01:00
Roeland Jago Douma c08e803db3
Catch forbidden http status code
If you try to do something on a DAV mount (external or federated share)
that is not allowed. We should not mark the storage as not available but
just fail somewhat gracefully.

Now by catching this and just properly returning the operation will just
fail (and notify the user) which is already a lot better then marking
the storage as unavailable and doing boom.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-17 09:11:15 +01:00
Robin Appelman f2724992fc
cast ctime and utime
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 12:39:56 +01:00
Robin Appelman 4c97181128
filter out empty filecache extension values
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 12:39:52 +01:00
Robin Appelman 066faaec05
fix folder delete
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 12:39:46 +01:00
Robin Appelman 43fa746ad9
dont create empty filecache extended rows
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 12:39:43 +01:00
Robin Appelman 136c4ef925
dont expose metadata etag for now
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 12:39:36 +01:00
Robin Appelman 1b6e647b63
expose filecache extension data in FileInfo
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 12:39:32 +01:00
Robin Appelman 842da3f183
store filecache extension fields
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 11:30:44 +01:00
Robin Appelman d3b6dbc0bc
move more cache logic to querybuilder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 11:30:41 +01:00
Roeland Jago Douma bc9b223e65
Fix DAV mimetype search
Fixes #15048
Catches the case where a full mimetype is sumbitted in the where like
clause. Before we didn't catch this and it was just forwarded as is
causing invalid queries.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-10-28 21:56:29 +01:00
Arthur Schiwon e8095cf737
use OCP\EventDispatcher\Event over Symfony's deprecated Event
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-10-17 13:31:48 +02:00
Julius Härtl a9c089064b
Deprecate TemplateManager
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-10-16 09:54:17 +02:00
Roeland Jago Douma 5917644536
Merge pull request #17276 from nextcloud/storage-id-eq
Get single storage id using `eq` instead of `in`
2019-10-09 15:17:49 +02:00
Roeland Jago Douma cc6874df19
Merge pull request #17264 from nextcloud/move-from-storage-wrappers
handle moveFromStorage within the same storage even when storage wrap…
2019-09-26 15:48:59 +02:00
Robin Appelman bde791cec9
use eq instead of in for loading single storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-26 15:04:04 +02:00
Robin Appelman 1a8f9b8b1d
log which storage id can't be inserted
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-26 15:04:00 +02:00
Roeland Jago Douma 6ac67011f4
Merge pull request #17262 from nextcloud/objectstore-remove-cache-on-delete
dont delete cache entries if deleting an object from object store failed
2019-09-26 11:24:02 +02:00
Robin Appelman 35f317df7b
handle moveFromStorage within the same storage even when storage wrappers are applied to the source storage
the target storage doesn't need additional handling for wrappers as the wrappers implementation of moveFromStorage already deals with that

Any storage based on local storage isn't affected by this as local storage already has it's own way of handling with this

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-25 19:17:06 +02:00
Robin Appelman 733d4b6cca
dont delete cache entries if deleting an object from object store failed
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-25 18:09:45 +02:00
Joas Schilling a4ba2113b2
Fix getById for files in appdata and the root mount
In case the path we are currently in is inside the appdata_* folder,
the original getById method does not work, because it can only look inside
the user's mount points. But the user has no mount point for the root storage.

So in that case we directly check the mount of the root if it contains
the id. If it does we check if the path is inside the path we are working
in.

Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-09-17 11:15:59 +02:00
Arthur Schiwon 20901c59d4
emit file events via Dispatcher, too
another step to get rid of hooks and emitters

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-09-09 22:56:04 +02:00
Roeland Jago Douma bf6082e119
Merge pull request #16836 from nextcloud/fix/16724/smb-availability
Fix SMB availability status + higher delay on auth issues
2019-09-09 16:50:42 +02:00
Julius Härtl 64fe9bc287
Return the proper jailed path when requesting the root path
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-09-04 13:25:17 +02:00
Arthur Schiwon 43bc31bacb
set a storage availability delay on auth issues to avoid lock out
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-08-22 12:40:15 +02:00
Joas Schilling 323642454a
Undefined variable response when server is no nextcloud anymore
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-08-20 12:54:58 +02:00
Roeland Jago Douma d14aed1048
Merge pull request #15946 from martink-p/bugxfix/9792/encrypted-external-webdav
Update Encryption.php
2019-08-15 10:22:50 +02:00
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>
2019-08-07 20:38:42 +02:00
Morris Jobke e21f440990
Merge pull request #16502 from nextcloud/bugfix/16474
Check the if we can actually access the storage cache for recent files
2019-07-29 16:59:26 +02:00
Morris Jobke e45fb5fa3e
Fix typo in comment
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-07-29 14:55:43 +02:00
Roeland Jago Douma fb78cd3ed8
Merge pull request #16570 from nextcloud/enh/supress_touch_error
Supress warnings touch can generate
2019-07-29 10:39:46 +02:00
Roeland Jago Douma 9ef23e2362
Merge pull request #16558 from nextcloud/enh/less_verbose_locked_logging
Do not log all locked exceptions
2019-07-27 10:39:11 +02:00
Roeland Jago Douma 1cc8a2f5d2
Supress warnings touch can generate
We already catch the result value. Having the warning being logged
explicitly doesn't help and polutes the log.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-07-26 17:26:59 +02:00
Roeland Jago Douma 4cc41cb4c7
Do not log all locked exceptions
This can happen for valid reasons (multiple users writing at the same
time) with for example the text app. Apps should properly handle it. No
reason to log it by default.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-07-26 14:55:13 +02:00
Roeland Jago Douma 0487144b26
Remove deprecated searchByTag
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-07-26 12:29:19 +02:00
Julius Härtl e43b341b04
Add additional check for read permissions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-07-24 14:01:24 +02:00
Julius Härtl 3674f6fa2d
Check the if we can actually access the storage cache for recent files
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-07-24 14:01:24 +02:00
Morris Jobke 48653d1a27
Merge pull request #16440 from marcelklehr/fix/objectstorage-put-contents
Fix File#putContents(string) on ObjectStorage
2019-07-17 22:38:41 +02:00
Marcel Klehr d46744e2f1 Fix File#putContents(string) on ObjectStorage
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2019-07-17 14:58:56 +02:00
Roeland Jago Douma 8ca2b31804
Do not keep searching for recent
If userA has a lot of recent files. But only shares 1 file with userB
(that has no files at all). We could keep searching until we run out of
recent files for userA.

Now assume the inactive userB has 20 incomming shares like that from
different users. getRecent then basically keeps consuming huge amounts
of resources and with each iteration the load on the DB increases
(because of the offset).

This makes sure we do not get more than 3 times the limit we search for
or more than 5 queries.

This means we might miss some recent entries but we should fix that
separatly. This is just to make sure the load on the DB stays sane.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-07-16 19:14:55 +02:00
Roeland Jago Douma e953205908
Use HTTP1.1 to read S3 objects
Some of the READs otherwise use HTTP/1.0 which is not always supported
by all backends. HTTP/1.1 is there since 1999 way longer than S3 so safe
to assume it is always there IMO.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-07-10 11:42:22 +02:00
John Molakvoæ 5a03189ce7
Mimetype list integrity check should not fail if it's changed (#15810)
Mimetype list integrity check should not fail if it's changed
2019-07-07 20:01:58 +02:00
Roeland Jago Douma 5312a07f55
Merge pull request #16107 from nextcloud/local-check-path
verify that paths are valid for recursive local move
2019-06-27 16:36:30 +02:00
Robin Appelman f39605dabc
verify that paths are valid for recursive local move
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-06-27 11:10:08 +02:00
Roeland Jago Douma 2f5810f26e
Merge pull request #15832 from nextcloud/bugfix/noid/fulltext-search-groupfolders
Fix full text search for groupfolders
2019-06-25 21:43:37 +02:00
Morris Jobke 9dac9710e4 Fix full text search for groupfolders
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-06-17 12:52:22 -01:00
martink-p 9cff71f5b0 Update Encryption.php
Signed-off-by: martink-p <47943787+martink-p@users.noreply.github.com>
2019-06-17 12:13:29 +02:00
martink-p 8b22ede5f3 Update Encryption.php
Signed-off-by: martink-p <47943787+martink-p@users.noreply.github.com>
2019-06-17 12:13:29 +02:00
martink-p 39a4fe40a3 Apply suggestions from code review
Co-Authored-By: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: martink-p <47943787+martink-p@users.noreply.github.com>
2019-06-17 12:13:29 +02:00
martink-p 4b9675df6c Update Encryption.php
Signed-off-by: martink-p <47943787+martink-p@users.noreply.github.com>
2019-06-17 12:13:29 +02:00
Robin Appelman b4e2d8f8ad
handle storage exceptions when trying to set mtime
not all storage backends can handle setting the mtime and they might
not always handle that error correctly.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-06-06 16:09:27 +02:00
Xheni Myrtaj d227f4d34c
Do not fail integrity check if mimetype list is changed
Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>
2019-05-29 22:43:23 +02:00
Roeland Jago Douma 58fe0b8032
Merge pull request #15776 from nextcloud/get-by-id-shares-last
search files by id in shared storages last
2019-05-29 21:56:15 +02:00
Robin Appelman 98dd526010
search files by id in shared storages last
this prevents unneeded recursion when the file is not in the share

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-05-28 20:03:45 +02:00
Julius Härtl 67dd4b018a
Check for free space on touch
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-05-28 13:06:59 +02:00