From 69bb59b9fe67041dae2c8cbce0ab72a151f7f615 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Fri, 25 Aug 2023 10:46:33 +0100 Subject: [PATCH] MDL-68435 customfield: fix plugin file serving callbacks. Incorrect parameter/method call was previously serving files with wrong filenames. --- customfield/field/textarea/lib.php | 2 +- customfield/lib.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/customfield/field/textarea/lib.php b/customfield/field/textarea/lib.php index 83389f37dad..92fb5523b75 100644 --- a/customfield/field/textarea/lib.php +++ b/customfield/field/textarea/lib.php @@ -72,5 +72,5 @@ function customfield_textarea_pluginfile($course, $cm, $context, $filearea, $arg } // We can now send the file back to the browser - in this case with a cache lifetime of 1 day and no filtering. - send_file($file, 86400, 0, $forcedownload, $options); + send_stored_file($file, DAYSECS, 0, $forcedownload, $options); } diff --git a/customfield/lib.php b/customfield/lib.php index f9aab27eabd..2bb99f4807d 100644 --- a/customfield/lib.php +++ b/customfield/lib.php @@ -82,6 +82,5 @@ function core_customfield_pluginfile($course, $cm, $context, $filearea, $args, $ } // We can now send the file back to the browser - in this case with a cache lifetime of 1 day and no filtering. - // From Moodle 2.3, use send_stored_file instead. - send_file($file, 86400, 0, $forcedownload, $options); + send_stored_file($file, DAYSECS, 0, $forcedownload, $options); }