Updated repository plugin documentation

Updated repository plugin documentation

by Davo Smith -
Number of replies: 6
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I've been asked to update the repository plugin documentation at http://docs.moodle.org/dev/Repository_plugins

(partially to include a few bits that were not previously documented, partially to clarify a few of the the other bits).

I have now done so, but wondered if anyone could take a look at it and see if they can spot any mistakes (either in the bits I've added / reorganised, or in the bits that were there originally).

Thanks,

Davo

Average of ratings: Useful (2)
In reply to Davo Smith

Re: Updated repository plugin documentation

by Rex Lorenzo -

The URL for the template seems to be broken: https://github.com/dongsheng/moodle-repository_demo

Maybe the template should be moved to the MoodleHQ GitHub, like the template for the module: https://github.com/moodlehq/moodle-mod_newmodule

In reply to Rex Lorenzo

Re: Updated repository plugin documentation

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The template was in part of the docs I hadn't updated. For the moment, I've removed that section completely, as I have no idea where the code is now located (if it is anywhere at all), or if it is still relevant. It can always be recovered from the wiki history, if someone wants to put it back again.

In reply to Davo Smith

Re: Updated repository plugin documentation

by Marina Glancy -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

The template is really simple, I don't think it needs creating a github repo. We were trying with Fred to create a dummy repository to test dynload=false behaviour in MDL-35664, you can still find zip in attachments to the issue.

Please note that in the most cases dynload=true is more recommended

In reply to Davo Smith

Re: Updated repository plugin documentation

by Rex Lorenzo -

Davo, I had been wondering about the "source" field in the mdl_files table and according to your documentation, the "source" field is the URL that the file was obtained from?

But while looking at my database sometimes it is a text entry. Also, is this the best field to get statistics on usage of the different content repositories?

For example, I am trying to get usage stats on our server and my current queries are:

Dropbox:

SELECT * FROM `mdl_files` WHERE source LIKE '%dropbox%' OR source LIKE 'Dropbox%'

Google docs:

SELECT * FROM `mdl_files` WHERE source LIKE '%google%'

Box:

SELECT * FROM `mdl_files` WHERE source LIKE '%box.net%' 

Server files:

SELECT * FROM `mdl_files` WHERE source LIKE '%Server files%'

Notice that Dropbox is sometimes a URL and other times not. Also, Server files is always a text description. Is there a better way to guage content repository usage?

In reply to Rex Lorenzo

Re: Updated repository plugin documentation

by Marina Glancy -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Rex,

Field files.source is a serialised array. It has an attribute 'source' (same name, a little confusing) that represents a human-readable source of the file. For example, it can say that file was added from Dropbox by user Sam and in his dropbox it had this particular name: $source['source'] = 'Dropbox (Sam): /stuff/file.txt'; We started storing this recently so your database may still have old-style values.

Repository can specify the value by overwriting get_reference_details()

Please note that $source['source'] is mostly needed for file references. The moment teacher really need it is when the reference stops working. He can look at the file in filemanager and see where this file was originally linking to. Or it is displayed during restore, for example when we could not restore a reference to private files from a course backup.

For files in draft area field files.source also contains the attribute 'original', we need it to trace modifications of files to keep the references. Repository plugins should not worry about it.

In reply to Marina Glancy

Re: Updated repository plugin documentation

by Rex Lorenzo -

Marina, so are the queries I posted the best way to get usage stats of content repositories? Or is there a better way?