Commit Graph

56 Commits

Author SHA1 Message Date
Julius Härtl e241f14f24
Delete files that exceed trashbin size immediately
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-11-23 09:11:53 +01:00
Joas Schilling 19816fe85f Don't leave cursors open when tests fail
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-10 14:18:02 +00:00
Joas Schilling ef22580a32 Use query builder instead of OC_DB in trashbin
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-07 09:21:46 +00:00
Julius Härtl 07506dd10c Restrict query when searching for versions of trashbin files
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-11-04 07:32:47 +00:00
Robin Appelman acef3620e0
dont hold a transaction during the move to trash
because moving to trash can take a long time, keeping a transaction active for the duration can lead to issues

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-10-05 15:25:36 +02:00
Christoph Wurst 1f7f93a695
Update license headers for Nextcloud 20 (again)
There are still lots of outdated headers, so time for another round of
updates.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-09-07 14:37:44 +02:00
Daniel Kesselberg 2513b64602
Change free space calculation
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-08-31 23:11:10 +02:00
blizzz a3d30bf4a2
Merge pull request #21954 from nextcloud/techdebt/noid/bootstrap-files_trashbin
Use IBootstrap for the files_trashbin app
2020-08-07 11:12:09 +00:00
Robin Appelman c2c9a6a0e1
fix object store trashbin handling
object stores are "special" given how they interact with the cache on their own

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-30 16:31:56 +02:00
Morris Jobke e84504c4d6
Use IBootstrap for the files_trashbin app
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-23 22:03:14 +02:00
Robin Appelman fcad692b4a
rollback cache rename if trashbin move fails
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-23 15:24:48 +02:00
Robin Appelman 5949849322
fix moving files from external storage to object store trashbin
having the "cache rename" after the "storage move" caused the target
to get the fileid from the source file, without taking care that the object
is stored under the original file id.

By doing the "cache rename" first, we trigger the "update existing file"
logic while moving the file to the object store and the object gets stored for the
correct file id

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-23 15:24:44 +02:00
Robin Appelman 050e2fe346
allow admin to configure the max trashbin size
this allows an admin to configure the max trashbin size instead of always relying on the users quota.

The trashbin size can be configured using the `occ trash:size` command and can be set both globally and per-user

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-07 14:45:08 +02:00
Robin Appelman 614acc9419
add locking to resolve concurent move to trashbin conflicts
uses a lock to prevent two requests from moving a file to the trashbin concurrently
(causing sql duplicate key errors)

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-05-06 20:36:55 +02:00
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:54:27 +02:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +02:00
Christoph Wurst afbd9c4e6e
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 13:54:22 +02: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 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Robin Appelman 964dc0a955
set retention obligation on existing `expiration` in tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-04 16:54:22 +01:00
Christoph Wurst 543190f8b3
Do not create Application instances directly
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-10-11 08:33:09 +02:00
Robin Appelman 9bf8ee701f
Update apps/files_trashbin/lib/Trashbin.php
Co-Authored-By: Morris Jobke <hey@morrisjobke.de>
2019-09-04 13:06:07 +02:00
Robin Appelman fafce34aa0
dont try to copy trash items to user if the user has not enough free space
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-07-29 14:05:49 +02:00
Robin Appelman 62a969f056
dont try to restore a trashbin item to a readonly target
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-03-14 16:18:43 +01:00
Morris Jobke 4704e719ed
Only fetch size of this storage without mount points - ref #14412
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-03-01 12:05:18 +01:00
Morris Jobke f6967a974f
Revert "Fix for issue 10862: calculation of free space ignores external storage (doesn't count towards quota)"
This reverts commit e806aa658c.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-03-01 12:03:33 +01:00
Felix Nieuwenhuizen e806aa658c Fix for issue 10862: calculation of free space ignores external storage (doesn't count towards quota)
Signed-off-by: Felix Nieuwenhuizen <felix@tdlrali.com>
2019-01-26 17:23:23 +01:00
Robin Appelman 4adac445dc
fix select statement
fix select statement
Make trashbin api modules

Apps can register trashbin backends for specific storages,
allowing them to modify trashbin behavior for storages

The old trashbin implementation has been wrapped in a "legacy" backend,
for future work this can be replaced with a new backend that better handles
shares while still keeping the legacy backend around to keep existing trash
from being accessible

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-10-17 14:56:45 +02:00
Lars Knickrehm 436c4f8954
Improved logging statement 2018-06-24 13:41:16 +02:00
Lars Knickrehm e360885eb0
Workaround for interrupting expired files deletion
Workaround avoiding "Error while running background job (class: OCA\Files_Trashbin\BackgroundJob\ExpireTrash, arguments: ): {"Exception":"OCP\\Files\\NotPermittedException","Message":"","Code":0,"Trace":"#0 \/var\/www\/cloud\/apps\/files_trashbin\/lib\/Trashbin.php(590): OC\\Files\\Node\\File->delete() [...]"
2018-05-28 00:59:20 +02:00
Morris Jobke dd34cb7540
Less deprecated calls to OCP\Util::writeLog
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-04-22 20:41:49 +02:00
Roeland Jago Douma 83873e3da1
Remove deprecated URL functions for OCP\Util
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 22:04:08 +01:00
Morris Jobke a661f043e1
Remove unneeded semicolon and parentheses
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 23:46:40 +01:00
Morris Jobke c005fc6755
Cleanup unused code
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 15:25:19 +01:00
Morris Jobke 31c5c2a592
Change @georgehrke's email
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 20:38:59 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Joas Schilling d703744d4a Fix comparisions in the trashbin app
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-08-01 13:56:12 +02:00
Roeland Jago Douma 549845aa73
Delete trash using node API to trigger preview deletion
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-07-24 11:14:12 +02:00
Morris Jobke b4fa812a3d Improve logging of trash bin inconsistencies
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-06-23 16:09:00 -05:00
Morris Jobke 1729e4471f
Update comments to Nextcloud
* based on PR by @Ardinis
* see #4311

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-11 23:16:27 -05:00
Juan Pablo Villafáñez 713faa0fc0
Use the expected method depending on the target being a file or folder
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-22 18:02:09 -06:00
Morris Jobke a4ad8af6e3
Add proper default value for datadir
* better safe than sorry
* fixes #3091

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-01-19 19:49:41 -06:00
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 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
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