Merge branch 'MDL-52217-master' of git://github.com/andrewnicols/moodle

Conflicts:
	repository/upgrade.txt
This commit is contained in:
David Monllao 2016-02-16 05:56:02 +08:00
commit 187137aa23
4 changed files with 27 additions and 8 deletions

View File

@ -1381,5 +1381,23 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2016020201.00);
}
if ($oldversion < 2016021500.00) {
$root = $CFG->tempdir . '/download';
if (is_dir($root)) {
// Fetch each repository type - include all repos, not just enabled.
$repositories = $DB->get_records('repository', array(), '', 'type');
foreach ($repositories as $id => $repository) {
$directory = $root . '/repository_' . $repository->type;
if (is_dir($directory)) {
fulldelete($directory);
}
}
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2016021500.00);
}
return true;
}

View File

@ -1663,18 +1663,16 @@ abstract class repository implements cacheable_object {
}
/**
* Decide where to save the file, can be overwriten by subclass
* Get a unique file path in which to save the file.
*
* The filename returned will be removed at the end of the request and
* should not be relied upon to exist in subsequent requests.
*
* @param string $filename file name
* @return file path
*/
public function prepare_file($filename) {
global $CFG;
$dir = make_temp_directory('download/'.get_class($this).'/');
while (empty($filename) || file_exists($dir.$filename)) {
$filename = uniqid('', true).'_'.time().'.tmp';
}
return $dir.$filename;
return sprintf('%s/%s', make_request_directory(), $filename);
}
/**

View File

@ -11,6 +11,9 @@ http://docs.moodle.org/dev/Repository_API
- repository_googledocs_admin_upgrade_notification()
- repository_boxnet_admin_upgrade_notification()
- repository_alfresco_admin_security_key_notice()
* The prepare_file() function will now return a file in a per-request directory which will
be automatically cleaned at the end of the request.
No modifications should be required as a result of this change.
=== 2.8 ===

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2016021100.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2016021500.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.