MDL_FILES multiple records

MDL_FILES multiple records

by Chris Meyer -
Number of replies: 4

I have a question on mdl_files.

We have a great many entries that have the same filename, filepath, filesize, creationdate in mdl_files. The only difference seems to be the record id and hashed filename.  Sometimes there are just two, but often 4, 5 or even 19 entries.  Is this intended?

If this is not the correct forum, please direct me on.  We are running Moodle 2.1+ build 20110719.  Fedora Linux 16, PHP 5.3.6-1, MYSQL 5.1.56-1. Database is innodb.

We upgraded from 1.9 several months ago and support 30 districts.  Generally, things are running great. 

: ) Chris

Average of ratings: -
In reply to Chris Meyer

Re: MDL_FILES multiple records

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Chris,
it depends on your users: if the same file has been uploaded in different "places"1 it will be (physically) saved once into the file system pool with several (logical) references into the DB, one for each time a user has used it in a "place"1.

1A "place" is uniquely identified in the new Files API with:

  • Context id: the instance of the plugin owning the file
  • Component: the type of the above plugin
  • File area: types defined by the above plugin
  • Item id: an identifier driven by the above plugin

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: MDL_FILES multiple records

by Dave Perry -
Picture of Testers

It's not completely clear from the documentation - how do you get the context of a file, using the course_modules table? We have a broken page (only got a course ID, and I have no raw server access) and the only way I can see of getting the files is to knock up a script that'll extract the paths to the files and let me export them that way.

In reply to Chris Meyer

Re: MDL_FILES multiple records

by Jean Michel -

I commented this strange behaviour some time ago in another post. I tested it and I found out that everytime you access to edit a form with files, a new instance in the table mdl_files is created, despite of the file already exists. I don't know the reason, nobody answered me about this, and I think only a developer could know this. If you enter 1000 times to edit some field of a form with files, 1000 new registers are created in MDL_FILES, even if you don't change the file.

In reply to Jean Michel

Re: MDL_FILES multiple records

by Asif Noor -

I see the issue still exists with moodle 2.5. whenever i access edit file, i see 2 entires in the table irrespective of i save it or not.