'not syncing correctly' ... if doing rsync maybe the rsync command is not correct and thus not syncing by removing old and adding new to the sync'd directory. ** I'd check that first, before messing with DB. **
In 1.9, it was possible for a person having access to the course ID directory to delete files or re-arrange files etc. without knowing they busted links in the course. On a 1.9 site one could figure that out by looking at URL's and some course ID directory exploring - if I re-call correctly.
With 2 and 3, however, entirely different picture .... files in a 2 and 3 are no longer stored by humanly re-cognizable names ... like 'mygreat.pdf', but, rather, as a 'contenthash' ... looks like: 0089c4a8ccec8d0cf09447444d05f3619e1625b6
(following the above example) and they are located (just for this example) in moodledata/filedir/00/89/
So that example files path is:
/pathtomoodledata/filedir/00/89/0089c4a8ccec8d0cf09447444d05f3619e1625b6
and it could be anything ... a gif, a jpeg, a pdf, a ppt(x), etc., etc. Only way ot see it's name or file type is to cross reference the DB. (well, there is a way to get info on it [but not much in many cases] from filedir directory
file -b ./00/89/0089c4a8ccec8d0cf09447444d05f3619e1625b6
and
head -n 10 ./00/89/0089c4a8ccec8d0cf09447444d05f3619e1625b6
Might give some clues.
In the DB, there could be more than one reference to a file as it's used in more than one course. There's only ONE physical file, though.
Moodle will complain a lot if it can't find files in filedir. Depending upon how many and what, I've had to 'fool' Moodle into thinking the DB references were correct by creating 0 byte 'touched' files that contain nothing so that I could edit the links and re-upload or simply delete them. That took a lot of work / time.
Sooooo .... no easy/no pain free way to fix that, me thinks. Maybe some real Moodle 'guru' will jump in here and enlighten both of us! ;) Anyone?
'spirit of sharing', Ken