MDL-41774 Fixed bug in file synchronisation by handle
MDL-42016 core_repository: Simplify API to sync external files

Too many functions, too different parameters, unnecessary DB queries.
All repositories developed for Moodle 2.3-2.5 will continue to work.

Also get rid of DB field files_reference.lifetime, it is absolutely unnecessary
because there is an API function for it and all repositories return constant there anyway.
MDL-42016 even better