diff --git a/blocks/html/lib.php b/blocks/html/lib.php index 17d98cecb28..a2555c3f88e 100644 --- a/blocks/html/lib.php +++ b/blocks/html/lib.php @@ -28,9 +28,10 @@ * @param string $filearea file area * @param array $args extra arguments * @param bool $forcedownload whether or not force download + * @param array $options additional options affecting the file serving * @return bool */ -function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload) { +function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload, array $options=array()) { global $SCRIPT; if ($context->contextlevel != CONTEXT_BLOCK) { @@ -64,7 +65,7 @@ function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $a } session_get_instance()->write_close(); - send_stored_file($file, 60*60, 0, $forcedownload); + send_stored_file($file, 60*60, 0, $forcedownload, $options); } /** diff --git a/blocks/upgrade.txt b/blocks/upgrade.txt index a87cbf8d1ff..b7e288e9c9b 100644 --- a/blocks/upgrade.txt +++ b/blocks/upgrade.txt @@ -1,6 +1,12 @@ This files describes API changes in /blocks/* - activity modules, information provided here is intended especially for developers. +=== 2.3 === + +required changes in code: +* block_xxx_pluginfile() is now given the 7th parameter (hopefully the last one) that + contains additional options for the file serving. The array should be re-passed + to send_stored_file(). === 2.0 === diff --git a/lib/filelib.php b/lib/filelib.php index 1d4a019cb36..31093981ad6 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -3976,7 +3976,7 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null) { $filefunction = $component.'_pluginfile'; if (function_exists($filefunction)) { // if the function exists, it must send the file and terminate. Whatever it returns leads to "not found" - $filefunction($course, $birecord, $context, $filearea, $args, $forcedownload); + $filefunction($course, $birecord, $context, $filearea, $args, $forcedownload, array('preview' => $preview)); } send_file_not_found();