Merge branch 'MDL-60001_gzopen' of https://github.com/mrmark/moodle

This commit is contained in:
Damyon Wiese 2017-10-19 13:00:13 +08:00
commit 022dccf2a7
2 changed files with 8 additions and 3 deletions

View File

@ -532,7 +532,12 @@ abstract class file_system {
* @return resource file handle
*/
public function get_content_file_handle(stored_file $file, $type = stored_file::FILE_HANDLE_FOPEN) {
$path = $this->get_remote_path_from_storedfile($file);
if ($type === stored_file::FILE_HANDLE_GZOPEN) {
// Local file required for gzopen.
$path = $this->get_local_path_from_storedfile($file, true);
} else {
$path = $this->get_remote_path_from_storedfile($file);
}
return self::get_file_handle_for_path($path, $type);
}

View File

@ -904,8 +904,8 @@ class core_files_file_system_testcase extends advanced_testcase {
$filecontent = 'example content';
$file = $this->get_stored_file($filecontent);
$fs = $this->get_testable_mock(['get_remote_path_from_storedfile']);
$fs->method('get_remote_path_from_storedfile')
$fs = $this->get_testable_mock(['get_local_path_from_storedfile']);
$fs->method('get_local_path_from_storedfile')
->willReturn(__DIR__ . "/fixtures/test.tgz");
// Note: We are unable to determine the mode in which the $fh was opened.