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

Limitation of file size in file system repository

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.9.4, 3.0.3, 3.1
    • Fix Version/s: None
    • Component/s: Repositories
    • Labels:
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE

      Description

      In versions former than 2.9.4+ I was able to use files from file system repository without any size limitation (eve if the php or the server are limitated). Always been admin.
      For example to restore a course packaged in a big file.

      I realized than in Moodle 2.9.4+ build 20160211 this was still possible, but in build 20160304 it's not possible anymore.

      The steps to reproduce this issue are these:
      1.- Create a File system repository
      2.- Upload via ftp (or another way) a big course backup file (bigger than the maxbytes value).
      3.- Beeing admin go to Courses > Restore course
      4.- Select the backup file from repository
      5.- Click "Select this file"
      6.- The limitation appears

      The problem is that line 286 of /repository/repository_ajax.php throwns a file_exception because file size limitation.

      I think the problem comes from function get_max_upload_file_size in lib/moodlelib.php
      This funcion wasn't used in former versions to check the capability ignorefilesizelimits

      Now, if the function receive the parameter USER_CAN_IGNORE_FILE_SIZE_LIMITS the function is returning the upload_max_filesize setting (or 5M by default), what force the limitation even in the file system repository for the admin.

      The affected code should be this:
      if (! $filesize = ini_get('upload_max_filesize'))

      { $filesize = '5M'; }

      $minimumsize = get_real_size($filesize);

      Aftewars the conditions are skipped if USER_CAN_IGNORE_FILE_SIZE_LIMITS is passed to get_max_upload_file_size, so the returned value for limitation is the get_real_size($filesize);

      In build 20160211 the returned value was directly USER_CAN_IGNORE_FILE_SIZE_LIMITS , what I think is correct if the user has the capability ignorefilesizelimits.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                11 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: