MDL-51306 mod_folder: Use context_module to find details
renderable should not be used for extracting details. Use cm to get context and dir information
This commit is contained in:
committed by
David Monllao
parent
985dca606f
commit
cd6e7e0da0
+7
-3
@@ -486,16 +486,20 @@ function folder_view($folder, $course, $cm, $context) {
|
||||
/**
|
||||
* Check if the folder can be zipped and downloaded.
|
||||
* @param stdClass $folder
|
||||
* @param folder_tree $foldertree
|
||||
* @param context_module $cm
|
||||
* @return bool True if the folder can be zipped and downloaded.
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
function folder_archive_available($folder, $foldertree) {
|
||||
function folder_archive_available($folder, $cm) {
|
||||
if (!$folder->showdownloadfolder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$size = folder_get_directory_size($foldertree->dir);
|
||||
$context = context_module::instance($cm->id);
|
||||
$fs = get_file_storage();
|
||||
$dir = $fs->get_area_tree($context->id, 'mod_folder', 'content', 0);
|
||||
|
||||
$size = folder_get_directory_size($dir);
|
||||
$maxsize = get_config('folder', 'maxsizetodownload') * 1024 * 1024;
|
||||
|
||||
if ($size == 0) {
|
||||
|
||||
Reference in New Issue
Block a user