Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36708

file_is_draft_area_limit_reached should not consider references

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4.2
    • Component/s: Files API
    • Labels:
      None
    • Testing Instructions:
      Hide
      1. Login as a student.
      2. Go to your private files.
      3. Add some file references (alias/shortcut) which altogether weigh about half of the overall limit of the area.
      4. Add some files to reach the overall limit.
      5. Make sure you can upload files even if the files and references sizes combined exceed the limit.
      6. Make sure you can't upload more files once the files alone exceed the overall limit.
      Show
      Login as a student. Go to your private files. Add some file references (alias/shortcut) which altogether weigh about half of the overall limit of the area. Add some files to reach the overall limit. Make sure you can upload files even if the files and references sizes combined exceed the limit. Make sure you can't upload more files once the files alone exceed the overall limit.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-36708-master

      Description

      lib/filelib.php:file_is_draft_area_limit_reached() should not consider the file references while checking the size of an area. This means that we have to update file file_get_draft_area_info() which itself could be improved a lot.

      Marina's comment on MDL-32639:

      There could be a performance improvement, actually not related to the issue itself. While doing review I noticed that function file_get_draft_area_info() is terribly inefficient. Basically all we want is to check if there are any files/subfolders in the area (or path). But instead of doing one simple count() query we retrieve all files and folders and create an instance of stored_file for each of them. There is a function file_storage::is_area_empty() but it does not really do what we need.
      Also file_get_draft_area_info() gets the total filesize regardless of whether file is reference or not. I would make another attribute in return value to show filesize of not-reference files.

      This issue can potentially create a regression introduced by MDL-33766, which would mean that the Private Files userquota could be reached where as they used references.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13