Was wondering if there is any way in Moodle 2.1x to track and report on the amount of file storage one particular user or course is taking up?
For billing and resource allocation purposes, we need to be able to track how our storage is used.
Reason why: Our Moodle host gives us a set storage allocation and we get charged if we go over it.
Our Moodle site hosts courses we deliver via our RTO, internal training coures AND externally funded courses.
If externally funded projects puts us over our hosting allocation, we need to be able to bill back to those projects.
If this isn't the right category for this question, please let me know that too.
Online Learning Specialist
Relationships Australia SA
Well, it is tricky to count because if two people upload an identical file into Moodle, then Moodle only stores one copy on disc. Whose allocation would you count that against?
The simplest thing would be to double-count - charge both people - and since you are interested in billing your users, you probably don't mind that
You can get all the information you need from
SELECT * FROM mdl_files f JOIN mdl_context ctx ON f.contextid = ctx.id
To make sense of that you need to understand Moodle contexts.
c.id AS courseid,
SUM(filesused.filesize) AS spaceused
FROM mdl_course c
SELECT DISTINCT cctx.instanceid AS courseid, f.contenthash, f.filesize
FROM mdl_context cctx
JOIN mdl_context fctx ON CONCAT(fctx.path, '/') LIKE CONCAT(cctx.path, '/%')
JOIN mdl_files f ON f.contextid = fctx.id
WHERE cctx.contextlevel = 50
) filesused ON filesused.courseid = c.id
GROUP BY c.id, c.shortname
ORDER BY spaceused DESC, c.shortname ASC
is a reasonably good estimate of file usage by course.
Thanks for that!
I tried uploading the plugin to the mod data file of our Moodle 2.1 site and got the following error message when I logged in and attempted to finished the install via Notifications and Upgrade. Any advice?
- line 435 of \lib\upgradelib.php: plugin_defective_exception thrown
- line 265 of \lib\upgradelib.php: call to upgrade_plugins_modules()
- line 1460 of \lib\upgradelib.php: call to upgrade_plugins()
- line 317 of \admin\index.php: call to upgrade_noncore()
It's not a module, it is an admin report. Also, the zip file you download from github has an unhelpful name.
The code needs to end up in the folder
I'll give that whirl and let you know how I get on.