mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
Merge branch 'MDL-66304' of https://github.com/golenkovm/moodle
This commit is contained in:
commit
25494613f4
@ -2159,23 +2159,26 @@ function readfile_accel($file, $mimetype, $accelerate) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($accelerate and !empty($CFG->xsendfile)) {
|
||||
if (empty($CFG->disablebyteserving) and $mimetype !== 'text/plain') {
|
||||
header('Accept-Ranges: bytes');
|
||||
} else {
|
||||
header('Accept-Ranges: none');
|
||||
}
|
||||
if ($accelerate and empty($CFG->disablebyteserving) and $mimetype !== 'text/plain') {
|
||||
header('Accept-Ranges: bytes');
|
||||
} else {
|
||||
header('Accept-Ranges: none');
|
||||
}
|
||||
|
||||
if ($accelerate) {
|
||||
if (is_object($file)) {
|
||||
$fs = get_file_storage();
|
||||
if ($fs->xsendfile($file->get_contenthash())) {
|
||||
return;
|
||||
if ($fs->supports_xsendfile()) {
|
||||
if ($fs->xsendfile($file->get_contenthash())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
require_once("$CFG->libdir/xsendfilelib.php");
|
||||
if (xsendfile($file)) {
|
||||
return;
|
||||
if (!empty($CFG->xsendfile)) {
|
||||
require_once("$CFG->libdir/xsendfilelib.php");
|
||||
if (xsendfile($file)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2185,7 +2188,6 @@ function readfile_accel($file, $mimetype, $accelerate) {
|
||||
header('Last-Modified: '. gmdate('D, d M Y H:i:s', $lastmodified) .' GMT');
|
||||
|
||||
if ($accelerate and empty($CFG->disablebyteserving) and $mimetype !== 'text/plain') {
|
||||
header('Accept-Ranges: bytes');
|
||||
|
||||
if (!empty($_SERVER['HTTP_RANGE']) and strpos($_SERVER['HTTP_RANGE'],'bytes=') !== FALSE) {
|
||||
// byteserving stuff - for acrobat reader and download accelerators
|
||||
@ -2223,9 +2225,6 @@ function readfile_accel($file, $mimetype, $accelerate) {
|
||||
byteserving_send_file($handle, $mimetype, $ranges, $filesize);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Do not byteserve
|
||||
header('Accept-Ranges: none');
|
||||
}
|
||||
|
||||
header('Content-Length: '.$filesize);
|
||||
|
@ -1833,6 +1833,15 @@ class file_storage {
|
||||
return $this->filesystem->xsendfile($contenthash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if filesystem is configured to support xsendfile.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function supports_xsendfile() {
|
||||
return $this->filesystem->supports_xsendfile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Content exists
|
||||
*
|
||||
|
@ -443,6 +443,16 @@ abstract class file_system {
|
||||
return xsendfile($this->get_remote_path_from_hash($contenthash));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if filesystem is configured to support xsendfile.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function supports_xsendfile() {
|
||||
global $CFG;
|
||||
return !empty($CFG->xsendfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that the content hash matches the content hash of the file on disk.
|
||||
*
|
||||
|
@ -22,6 +22,8 @@ information provided here is intended especially for developers.
|
||||
at least a single checkbox item is selected or not.
|
||||
* Final deprecation (removal) of the core/modal_confirm dialogue.
|
||||
* Upgrade scssphp to v1.0.2, This involves renaming classes from Leafo => ScssPhp as the repo has changed.
|
||||
* Implement supports_xsendfile() method and allow support for xsendfile in alternative_file_system_class
|
||||
independently of local files (MDL-66304).
|
||||
* The methods get_local_path_from_storedfile and get_remote_path_from_storedfile in lib/filestore/file_system.php
|
||||
are now public. If you are overriding these then you will need to change your methods to public in your class.
|
||||
* $CFG->httpswwwroot has been removed. It is no longer necessary as loginhttps has already been removed and it's no longer being
|
||||
|
Loading…
x
Reference in New Issue
Block a user