diff --git a/admin/tasklogs.php b/admin/tasklogs.php index ef808c0b821..7820f60b2f4 100644 --- a/admin/tasklogs.php +++ b/admin/tasklogs.php @@ -53,7 +53,7 @@ if (null !== $logid) { header("Content-Disposition: attachment; filename=\"{$filename}\""); } - readstring_accel($log->output, 'text/plain', false); + readstring_accel($log->output, 'text/plain'); exit; } diff --git a/lib/filelib.php b/lib/filelib.php index 2d5e6754682..daae058311a 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -2250,10 +2250,10 @@ function readfile_accel($file, $mimetype, $accelerate) { * Similar to readfile_accel() but designed for strings. * @param string $string * @param string $mimetype - * @param bool $accelerate + * @param bool $accelerate Ignored * @return void */ -function readstring_accel($string, $mimetype, $accelerate) { +function readstring_accel($string, $mimetype, $accelerate = false) { global $CFG; if ($mimetype === 'text/plain') { @@ -2264,14 +2264,6 @@ function readstring_accel($string, $mimetype, $accelerate) { } header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT'); header('Accept-Ranges: none'); - - if ($accelerate and !empty($CFG->xsendfile)) { - $fs = get_file_storage(); - if ($fs->xsendfile(sha1($string))) { - return; - } - } - header('Content-Length: '.strlen($string)); echo $string; } @@ -2320,7 +2312,7 @@ function send_temp_file($path, $filename, $pathisstring=false) { // send the contents - we can not accelerate this because the file will be deleted asap if ($pathisstring) { - readstring_accel($path, $mimetype, false); + readstring_accel($path, $mimetype); } else { readfile_accel($path, $mimetype, false); @unlink($path); @@ -2506,7 +2498,7 @@ function send_file($path, $filename, $lifetime = null , $filter=0, $pathisstring if (empty($filter)) { // send the contents if ($pathisstring) { - readstring_accel($path, $mimetype, !$dontdie); + readstring_accel($path, $mimetype); } else { readfile_accel($path, $mimetype, !$dontdie); } @@ -2526,7 +2518,7 @@ function send_file($path, $filename, $lifetime = null , $filter=0, $pathisstring } $output = format_text($text, FORMAT_HTML, $options, $COURSE->id); - readstring_accel($output, $mimetype, false); + readstring_accel($output, $mimetype); } else if (($mimetype == 'text/plain') and ($filter == 1)) { // only filter text if filter all files is selected @@ -2542,12 +2534,12 @@ function send_file($path, $filename, $lifetime = null , $filter=0, $pathisstring } $output = '
'. format_text($text, FORMAT_MOODLE, $options, $COURSE->id) .'
'; - readstring_accel($output, $mimetype, false); + readstring_accel($output, $mimetype); } else { // send the contents if ($pathisstring) { - readstring_accel($path, $mimetype, !$dontdie); + readstring_accel($path, $mimetype); } else { readfile_accel($path, $mimetype, !$dontdie); } diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 2f785c6cfff..eac9093d8a6 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -68,6 +68,7 @@ validation against and defaults to null (so, no user needed) if not provided. and should be set to either false or true. Developers will probably want to set this to false. * The core_enrol_edit_user_enrolment webservice has been deprecated. Please use core_enrol_submit_user_enrolment_form instead. * \single_button constructor has a new attributes param to add attributes to the button HTML tag. +* Attempting to use xsendfile via the 3rd param of readstring_accel() is now ignored. === 3.7 ===