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

Add a per-request directory helper

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.9
    • Fix Version/s: None
    • Component/s: Administration
    • Labels:

      Description

      The make_temp_directory() function is meant to only be used to create directories which are only present for the current request.

      Therefore it should be possible to enforce this, however it's never been enforced before, so doing so now would be light juggling razors.

      We should create a new per-request directory helper (make_request_directory()), which:

      1. does not take a dirname argument (too tempting to play silly buggers with it); and
      2. is automatically removed at the end of the process.

      We can then start to replace all uses of make_temp_directory() with this, and eventually deprecate make_temp_directory altogether.

      Since request directories should be local to individual web server (in a clustered environment), we ideally want the new directory to be in local storage, and not shared storage. To do so, we can either:

      1. create a new directory requirement and config setting; or
      2. (ab?)use localcachedir.

      For the moment, I've used the localcachedir option as I feel that it is a suitable location in this instance.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Lyons
              Reporter:
              dobedobedoh Andrew Lyons
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: