Commit Graph

286 Commits

Author SHA1 Message Date
Roeland Jago Douma 6f96af0fce Merge pull request #2819 from nextcloud/trash-ext-link-uselinkowner
Fallback to share link owner when no owner found
2016-12-23 14:36:34 +01:00
Vincent Petry 34d466b2f6
Fallback to share link owner when no owner found
When creating link shares from external storage, the filesystem cannot
find an owner in some scenarios (ex: system-wide mounts). In such
cases, fall back to using the current user's trashbin which happens to
also be the user who created the link share.

Fixes an issue where this scenario made deletion impossible due to
missing user information.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-12-22 10:48:32 +01:00
Bjoern Schiessle a1d6f3068a
make code more robust
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-12-21 18:02:19 +01:00
Bjoern Schiessle 60810b44bc
check for class name in case class is not loaded
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-12-21 17:28:50 +01:00
Bjoern Schiessle 0e4eeab3c1
add a copy to the owners trash bin if another user moves a file out of a shared folder
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-12-21 17:28:47 +01:00
Roeland Jago Douma 55af6b45f7
More tests
* PreviewController test
* PublicPreview test
* Versions Preview test
* Trash Preview test

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Roeland Jago Douma 5d11085190
Move over files_trashbin
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Jörn Friedrich Dreyer f8352fcb8d
introduce callForSeenUsers and countSeenUsers (#26361)
* introduce callForSeenUsers and countSeenUsers

* add tests

* oracle should support not null on clob

* since 9.2.0
2016-10-28 08:44:05 +02:00
Steven Bühner 1bd4eebb26
Also fire a bulk pre- and post-delete hook 2016-09-20 12:07:03 +02:00
Steven Bühner 2b37dc9c9e
Always use the same relative Path (Starting from users home dir. i.e.: "/files_trashbin/...") 2016-09-20 12:07:00 +02:00
Steven Bühner 55fe036dbf
Take the same path (with /USERNAME/ as base) for every emmited hooks 2016-09-20 12:06:56 +02:00
Steven Bühner a41541ae22
Emit hooks for each file before and after all files in trashbin have been deleted. 2016-09-20 12:06:51 +02:00
Steven Bühner 2f555cb10d
Fiy typo 2016-09-20 12:06:47 +02:00
Steven Bühner 0408d9a2e4
Emit Hooks for each file bevore and after all files in trashbin have been deleted. 2016-09-20 12:06:43 +02:00
Bjoern Schiessle 68b53669c0
detect the correct mimetype of the files in the trashbin, therefore we have to check the filename without the appended timestamp 2016-09-09 15:36:30 +02:00
Thomas Müller 297d2e48ad
Add occ command to expire the trashbin (#25878)
* Add occ command to expire the trashbin

* Fix versions folder in setup check
2016-08-29 14:30:40 +02:00
Jörn Friedrich Dreyer d59cb04427
Skip version and trash expiry for users that never logged in 2016-08-10 10:51:51 +02:00
Joas Schilling 0215b004da
Update with robin 2016-07-21 18:13:58 +02:00
Joas Schilling 813f0a0f40
Fix apps/ 2016-07-21 18:13:57 +02:00
Lukas Reschke aba539703c
Update license headers 2016-05-26 19:57:24 +02:00
Vincent Petry 63bbbf29f4
Add wrapper for NFD encoding workaround 2016-05-20 09:33:59 +02:00
Joas Schilling d5dee80580 Move files_trashbin to PSR-4 (#24570) 2016-05-12 09:48:53 +02:00
Robin Appelman 435cd31fa6 use the cache for trash listing 2016-05-03 14:36:46 +02:00
Joas Schilling 9ebae0bdeb
Chunk the users correctly in the trashbin and versions background job 2016-04-20 10:36:15 +02:00
Stefan Weil 217d9e8e95 apps/files_trashbin: Fix typos in comments (found and fixed by codespell)
Fix also a wrong word.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-03-30 10:14:26 +02:00
Vincent Petry 0eb5292aaf Properly check path validity before deleting to trash
This prevents deleting the whole "files" folder of the user whenever
$ownerPath is empty. This can happen in concurrency situations.
2016-03-04 15:27:31 +01:00
Lukas Reschke c353d51810 Remove Scrutinizer Auto Fixer 2016-03-01 17:48:23 +01:00
Lukas Reschke 933f60e314 Update author information
Probably nice for the people that contributed to 9.0 to see themselves in the AUTHORS file :)
2016-03-01 17:25:15 +01:00
Victor Dubiniuk aac6932e92 Skip users with no trashbin 2016-02-24 18:08:45 +03:00
Bjoern Schiessle ac1c3d27b7 get the actual user instead of a federated cloud id
$view->getUidAndFilename($filename); returns the federated cloud id in case of
a federated share. But in this case we need the local user who "owns" the file
which is the current logged in user in case of a federated share
2016-02-18 10:16:59 +01:00
Thomas Müller 9e415a956a Merge pull request #22451 from owncloud/use-proper-user-folder
Handles null as return code and uses proper UserFolder in trashbin
2016-02-17 10:58:31 +01:00
Morris Jobke de58364eb8 Handles null as return code and uses proper UserFolder in trashbin 2016-02-16 18:45:25 +01:00
Vincent Petry 7bed529951 Don't resize trash when no user
Happens when overwriting files on federated shares.
2016-02-16 16:29:07 +01:00
Arthur Schiwon 3a796d1e15 Consolidate getQuota and setQuota methods in User instance 2016-02-09 17:16:43 +01:00
Thomas Müller 6824704699 Merge pull request #21117 from owncloud/owner-file-exists
Only return an owner if the file exists + improved getUidAndFilename
2016-01-15 13:31:56 +01:00
Thomas Müller 13ce6d0f1c Merge pull request #21544 from owncloud/trashbin-permissions
set etag and permission fields for trashbin entries
2016-01-15 13:22:54 +01:00
Thomas Müller 682821c71e Happy new year! 2016-01-12 15:02:18 +01:00
Robin Appelman 8890c88c11 handle not found in trash hook 2016-01-11 11:40:58 +01:00
Robin Appelman 300eb54c87 de-deplicate getUidAndFilename 2016-01-11 11:40:58 +01:00
Robin Appelman cb3d3ebf50 set etag and permission fields for trashbin entries 2016-01-08 13:07:23 +01:00
Morris Jobke ecdf88e41b Use proper public API for OC_Helper::getFileNameMimeType 2015-12-17 17:07:48 +01:00
Robin Appelman 415cf92784 Fix thrashbin wrapper when no user is loggedin 2015-12-11 14:27:37 +01:00
Scrutinizer Auto-Fixer 0f1be1b601 Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-12-07 20:08:20 +00:00
Morris Jobke 574d0d08bb Cleanup trashbin expire code
* requested by @schiesbn
2015-11-30 11:54:03 +01:00
Morris Jobke 7aa07bcf1c Deduplicate queued trashbin expire jobs
* fixes #20425
* this removes the argument trashbin size from the expire job - it is now
  calculated in the expire job
* the queue now detects properly that the job is already queue and doesn't
  add it again
2015-11-27 14:40:31 +01:00
Robin Appelman b025f07fb7 Make Cache\Updater per storage 2015-11-25 14:16:00 +01:00
Lukas Reschke 8f09d5b67c Update license headers 2015-10-26 14:04:01 +01:00
Lukas Reschke 13e817e901 Throw exception on `getPath` if file does not exist
Currently the `getPath` methods returned `NULL` in case when a file with the specified ID does not exist. This however mandates that developers are checking for the `NULL` case and if they do not the door for bugs with all kind of impact is widely opened.

This is especially harmful if used in context with Views where the final result is limited based on the result of `getPath`, if `getPath` returns `NULL` PHP type juggles this to an empty string resulting in all possible kind of bugs.

While one could argue that this is a misusage of the API the fact is that it is very often misused and an exception will trigger an immediate stop of execution as well as log this behaviour and show a pretty error page.

I also adjusted some usages where I believe that we need to catch these errors, in most cases this is though simply an error that should hard-fail.
2015-10-25 17:58:21 +01:00
Robin Appelman 2e8232e803 Fix trashbin handling of unknown/unlimited free space 2015-10-16 21:41:51 +02:00
Morris Jobke b945d71384 update licence headers via script 2015-10-05 21:15:52 +02:00