iamandrew / moodle-block_coursefiles

A block to view course file storage usage.
GNU General Public License v2.0
2 stars 0 forks source link

Problem in Moodle 3.2 #5

Open 2shediac opened 7 years ago

2shediac commented 7 years ago

On Moodle 3.2 (2017022800) - there is a discrepancy between the course file usage report and the report in the course.

If you look at course files report (screen shot attached) you can see that for M32 there is size of 35kb, but when I go into the course it does not show any files,

Also on the course files report it shows 349kb for Demo course, but when I go into the course it shows less than 10kb.

coursefilemain coursefilescourse

demo

Tazoeur commented 6 years ago

I have the same problem. Do you have an idea of where the issue is ?

I've seen that you sum the file size from the mdl_files table, but by exemple the .zip (or other module related files) are not listed in mdl_files. I've also see that you take care displaying the course backups but I didn't see how you do that.

Is it possible that in the report, you add the size of a file not displayed in the report ?

I assume that if the two reports are not displaying the same total size, it's because two different methods are used to calculate a course size. Could you explain why ?

Regards, Guillaume

Tazoeur commented 6 years ago

After a bit of inverstigation, I managed to spot where the problem is.

The SQL responsible for this :

SELECT
         cm.course,
         c.fullname,
         cx.contextlevel,
         f.component,
         f.filearea,
         f.filename,
         f.filesize,
         f.id
       FROM mdl_files f
         JOIN mdl_context cx ON f.contextid = cx.id
         JOIN mdl_course_modules cm ON cx.instanceid = cm.id
         JOIN mdl_course c ON cm.course = c.id
       WHERE filename <> '.'

(locallib.php file , block_coursefiles_get_all_courses() function )

Because it also count the files from 'component' = 'user' and 'filearea' = 'private' and the other request (from the detailed report) does not.

I hope this will help.

Have a nice day, Guillaume