Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not count shared files on trashbin free space calculation #36494

Merged
merged 1 commit into from
Dec 3, 2019

Conversation

VicDeo
Copy link
Member

@VicDeo VicDeo commented Nov 29, 2019

Description

Get free space directly instead of calculating it as quota - occupied

Related Issue

Motivation and Context

Trash bin is emptied if the user has large files shared with him

How Has This Been Tested?

  1. create user1 with 5 GB quota and user2 with 1 GB quota local storage
  2. upload a 1.7 GB file to user1 and share it with user2
  3. login as user2 and create a text file and delete that text file NOT THE BIG SHARED FILE!
  4. set 'trashbin_retention_obligation' => 'auto,180',
  5. run cron.php
  6. look in logs.

Expected Result

the shared file should not count in the quota for user2 and the new created text file should remain in the trash bin of user2

Actual Result

The file is deleted from trash bin

{
  "reqId": "dV1TZBjg6TFOw4xok0Qu",
  "level": 0,
  "time": "2019-11-18T16:40:04+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "cron",
  "method": "--",
  "url": "--",
  "message": "Started background job of class : OC\\Command\\CommandJob with arguments : O:33:\"OCA\\Files_Trashbin\\Command\\Expire\":1:{s:39:\"\u0000OCA\\Files_Trashbin\\Command\\Expire\u0000user\";s:5:\"user2\";}"
}
{
  "reqId": "dV1TZBjg6TFOw4xok0Qu",
  "level": 1,
  "time": "2019-11-18T16:40:04+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "files_trashbin",
  "method": "--",
  "url": "--",
  "message": "remove \"carlos.txt\" (19B) to meet the limit of trash bin size (50% of available quota)"
}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@VicDeo VicDeo added this to the development milestone Nov 29, 2019
@VicDeo VicDeo self-assigned this Nov 29, 2019
@codecov
Copy link

codecov bot commented Nov 29, 2019

Codecov Report

Merging #36494 into master will decrease coverage by <.01%.
The diff coverage is 70%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #36494      +/-   ##
============================================
- Coverage     64.68%   64.68%   -0.01%     
  Complexity    19024    19024              
============================================
  Files          1268     1268              
  Lines         74369    74369              
  Branches       1311     1311              
============================================
- Hits          48106    48104       -2     
- Misses        25877    25879       +2     
  Partials        386      386
Flag Coverage Δ Complexity Δ
#javascript 54.02% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 65.86% <70%> (-0.01%) 19024 <4> (ø)
Impacted Files Coverage Δ Complexity Δ
apps/files_trashbin/lib/Quota.php 84% <70%> (-8%) 9 <4> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24443e5...07fc074. Read the comment docs.

@VicDeo VicDeo changed the title Use system helper to get free space Do not count shared files on trashbin free space calculation Dec 2, 2019
@VicDeo VicDeo force-pushed the bugfix/e3610 branch 2 times, most recently from 455d113 to 3c02e6c Compare December 2, 2019 14:38
@VicDeo VicDeo force-pushed the bugfix/e3610 branch 4 times, most recently from 9a0bb06 to 321f380 Compare December 3, 2019 12:34
Copy link
Contributor

@micbar micbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@VicDeo VicDeo merged commit 9d5f7ae into master Dec 3, 2019
@delete-merged-branch delete-merged-branch bot deleted the bugfix/e3610 branch December 3, 2019 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants