diff --git a/course/dnduploadlib.php b/course/dnduploadlib.php index d3be854817a..655ddd11e7f 100644 --- a/course/dnduploadlib.php +++ b/course/dnduploadlib.php @@ -495,6 +495,8 @@ class dndupload_ajax_processor { throw new moodle_exception('errornouploadrepo', 'moodle'); } $repo = reset($repo); // Get the first (and only) upload repo. + // Pre-emptively purge the navigation cache so the upload repo can close the session. + navigation_cache::destroy_volatile_caches(); $details = $repo->process_upload(null, $maxbytes, $types, '/', $draftitemid); if (empty($this->displayname)) { $this->displayname = $this->display_name_from_file($details['file']); diff --git a/repository/upload/lib.php b/repository/upload/lib.php index f42c054b3a5..510b7d49b53 100644 --- a/repository/upload/lib.php +++ b/repository/upload/lib.php @@ -82,6 +82,8 @@ class repository_upload extends repository { $license = null, $author = '', $overwriteexisting = false, $areamaxbytes = FILE_AREA_MAX_BYTES_UNLIMITED) { global $USER, $CFG; + \core\session\manager::write_close(); + if ((is_array($types) and in_array('*', $types)) or $types == '*') { $this->mimetypes = '*'; } else {