MDL-52217 repository: prepare_file should use per-request directory
authorAndrew Nicols <andrew@nicols.co.uk>
Fri, 29 Jan 2016 04:12:48 +0000 (12:12 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Mon, 15 Feb 2016 07:54:05 +0000 (15:54 +0800)
commita9e12347b790abc321817c3262f97b029d7905e2
tree9990fd7bbcc37d585c8ebf93bf2f58f97d81bb08
parent2f45a11ac4178ae1d22dbf41fffa6493e741788f
MDL-52217 repository: prepare_file should use per-request directory

The repository API defaults has a function, prepare_file, which is
responsible for creating a unique file to be used during the current
request.

This is usually used in the repository's get_file() function to store the
file before it is used elsewhere in the API to save the file to the
filestorage API.
It is also sometimes used to temporarily store credentials for the lifetime
of the session.

In all cases, this file is only expected to exist for the duration of the
session.

Switching to use of a per-request directory using make_request_directory()
ensures that the tempdir does not grow without control.

This commit also adds an upgrade step to remove all old temp directories
created by any repository currently installed.
lib/db/upgrade.php
repository/lib.php
repository/upgrade.txt
version.php