Moodle 3.5 files in repository not being picked up

Moodle 3.5 files in repository not being picked up

by Adam Cripps -
Number of replies: 9

We have a file repository that has been working fine - until we reauthored some of our SCORM modules and then replaced the files in the repository. When we reauthored the modules, we upgraded them from SCORM version 1.2 to 2004. The filenames are the same as are the directory names.

However, when we click into the course content, it doesn't have the SCORM file associated with it any more, meaning we have to manually re-attach it (which works). However, we have over 700 of these modules - is there something that would cause Moodle to not see these files anymore?

Thanks in advance.

Average of ratings: -
In reply to Adam Cripps

Re: Moodle 3.5 files in repository not being picked up

by Ken Task -
Picture of Particularly helpful Moodlers

Not sure if this will answer completely or in which tables one might have to search, but I'd start with mdl_scorm.   'reference' column.

Also in mdl_files component = scorm does have filename and filepaths.

Manually changing files related had to be done outside of Moodle (correct)?   So have ownerships/permisions on changed files changed?

'spirit of sharing', Ken




In reply to Ken Task

Re: Moodle 3.5 files in repository not being picked up

by Adam Cripps -

So the mdl_scorm reference field has the filenames that we are expecting (but not the file paths). 

The file paths seem to be in mdl_file.filepath, although the paths don't follow the usual pattern - they look more like the contents of the scorm packages.

Ownership and permissions were fixed (when I manually copied the files over I wasn't the apache user, but I fixed that with chown -R apache.apache /var/moodledatadir).

I'm running out of ideas here as there aren't any errors, just empty modules with no scorm files.

In reply to Adam Cripps

Re: Moodle 3.5 files in repository not being picked up

by Ken Task -
Picture of Particularly helpful Moodlers

So you are trying to directly manipulate files in moodledata/filedir/XX/XX/ that are scorm zip's?

Using mysql client search for one of those uploaded .zip files and get the contenthash as well as contextid.

then another query like:

select contenthash,component,filearea,contextid,filename,filesize from mdl_files where (component like '%scorm%' and contextid like '3469');

I did this for a site that uses scorm almost exclusively ... that's where the contextid came from in this example.

The zip file originally uploaded (you call module) was named: interactive_long_09_SL2_17_07-Storylineoutput.zip

72036926 in size and when unzipped in a test directory on the server ...

adlcp_rootv1p2.xsd    ims_xml.xsd                                        lms            story.html
imscp_rootv1p1p2.xsd  index_lms.html                                     meta.xml       story_html5.html
imsmanifest.xml       index_lms_html5.html                               mobile         story.swf
imsmd_rootv1p2p1.xsd  interactive_long_09_SL2_17_07-Storylineoutput.zip  story_content  story_unsupported.html

For that one scorm package ... which is unzipped .... there are 843 references in mdl_files to files contained in the scorm package - in moodledata/filedir/ none of them have the same contenthash directories ... but are spread out all over moodledata/filedir/

So am not sure one can manipulate 'modules' (scorms) in the fashion you are attempting.

'spirit of sharing', Ken

In reply to Ken Task

Re: Moodle 3.5 files in repository not being picked up

by Adam Cripps -

Thanks Ken - you're right - I'm trying to update SCORM packages, but don't want to manually have to 're-associate' them with a lesson. What does contenthash and contentid do - is it keep a record of whether the file changes (the hash) and then associate that with a lesson (the id)?

Just to be clear, I'm not manipulating the files directly in the filedir directory, but have set up a file repository which means that we can pull in content using a regular file/dir structure - this is know as the file repository plugin. We have, in the past, just overwritten the SCORM files and moodle has picked up the new version - however, that didn't happen this time.

The difference between your process and the one we are using is that we don't unzip our SCORM packages - I'm guessing the scorm player will do that for us when it is requested(?)

I hope that makes it clearer as to what I'm trying to do - it's always a little trickier over a text medium.

In reply to Adam Cripps

Re: Moodle 3.5 files in repository not being picked up

by Ken Task -
Picture of Particularly helpful Moodlers

So you are using 'lessons'???? ... which is a mod.  Can one upload a 'lesson' as a zip and choose to use 'aliases'?

Are you using an addon plugin?

Ok, this 'file system repo' that contains scorms - where is it located?  In order for Moodle to see them one has to setup a file system repo and there has to be something in moodledata/repository/ so Moodle can know where it is.

And in the repo do you have only the zips?   Thought one had to link to the manifest.xml file which is the roadmap to all the files contained in the package (I thought).  When uploaded are you using the option to link via alias?

contenthash is bascially a path and the file name ...

qweaksld302q343dskwljlsshg

is moodledata/filedir/qw/ea/ and inside there a file named qweaksld302q343dskwljlsshg

Think context ID is really, for lack of a better term, a 'module' (as you call it) id number.

Have you searched mdl_files table to see what moodle is doing with these 'lessons'/SCORM modules?   Think you are going to have to do that ... assume nothing! ;)

Yes, it is hard to describe textually ... so how about some screen shots?

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.5 files in repository not being picked up

by Adam Cripps -

Thanks again Ken - I think I have managed to solve this. However, I need to add that I'm not using the lesson plugin - apologies, I thought this was just the term for a piece of learning content.

The way to replicate this 'bug' is to copy the files directly to the repository directory. After doing this, moodle won't recognise the files. If you copy the files to /tmp/scorm (on the server) instead and then copy from /tmp/scorm to /var/moodledatadir, then moodle is happy.

Such a strange issue - do you think it's worth logging as a bug to see if anyone else can replicate?

In reply to Adam Cripps

Re: Moodle 3.5 files in repository not being picked up

by Ken Task -
Picture of Particularly helpful Moodlers

Yep.  I'd say its strange ... but I still don't get how Moodle is picking anything up from /tmp/scorm/ and in the round-about way you are describing getting (somehow) magically into moodledata/filedir/

This part: "copy the files directly to the repository directory. After doing this, moodle won't recognise the files

So there is, for example, a 'scorm' directory in /moodledata/repository/ .... and scorm files (zips) uploaded there through something external to Moodle .... scp, ftp, whatever.   That right so far?   scp/ftp users used during transfer of files aren't 'apache' ... if, for example, and I do this all the time, I use scp to get something into a file system repo, I normally scp as the root user so files in whatever directory I uploaded to are tagged as root:root .... have to change ownerships/permission to apache:apache.

In order to report this as a bug you will have to provide steps to replicate the issue.

Suggest you make a screencast of the entire process you use and how you setup things cause I surely can't get it ... and don't really have to the time to play all that much to attempt to replicate the setup and test.

Just getting old, I guess! :\

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.5 files in repository not being picked up

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I think Adam is dropping the files in:

https://docs.moodle.org/en/File_system_repository

and then using the top option in this post:
https://danmarsden.com/blog/2013/09/24/managing-scorm-content-in-moodle-2-6/

But I suspect he didn't choose "alias" when selecting the file, and selected "make a copy of the file" when setting up the SCORM package, so instead of maintaining the link to the file system repository it copies the scorm zip into the standard filedir in Moodle so when you replace the file in the file system repository it doesn't update the SCORM package.

Updating the SCORM package to use an alias instead of a copy of the scorm file might need a bit of database hacking by someone that understands the file api. otherwise you might just need to go through them and link them up manually again.

Average of ratings: Useful (1)
In reply to Dan Marsden

Re: Moodle 3.5 files in repository not being picked up

by Ken Task -
Picture of Particularly helpful Moodlers

Many thanks, Dan!  I just didn't know how to describe and/or the right questions to ask .... thought it was as you described.

Adam .... what Dan says! smile

Now I can rest my 'feeble'!

'spirit of sharing', Ken