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

Per-request temp directories

    XMLWordPrintable

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide
      1. Run provided unit tests

      The unit tests do not cover race conditions. If you can think of some witty and novel way of testing race conditions, please do!

      Show
      Run provided unit tests The unit tests do not cover race conditions. If you can think of some witty and novel way of testing race conditions, please do!
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull Master Branch:
      MDL-44874-master
    • Story Points:
      40
    • Sprint:
      Team Beards Sprint 5
    • Issue size:
      Large

      Description

      According to the docs: "If any script tries to use temp files that were not created during current request it is a bug that needs to be fixed."

      Now in load balanced environment (without sticky sessions) with multiple web servers and local temp dirs defined on the web servers local file systems, there are at least two cases where files are used for more than the current request:

      • upload users via CSV
      • restoring course backups

      Trying to perform the above actions leads to errors and the inability to complete the actions unless the local tempidr "$CFG->tempdir" is removed from the configuration, losing the local tempdir functionality.

      This issue introduces a new function:

      make_request_directory($exceptiononerror = true);
      

      This can be used in the same way as make_temp_directory(), but it does not take a subdirectory as an argument.
      It always outputs the full path to the new directory, and ensures that it will be deleted after the request finishes.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/May/15